Creating Hello World Application in CodeIgniter

PHP CMS Frameworks July 17, 2013 3 comments
In this article, we are going to discuss about How to create a Hello World application in CodeIgniter (CI). Before we start creating Hello World application in CodeIgniter (CI), we must know about Model View Controller (MVC) pattern. Because CodeIgniter (CI) follows the MVC pattern.

Step 1 : Creating Controller

Create a controller with the file name "helloworld.php" within "<root folder>/application/controllers" folder and write the following code in that file.

<?php
class Helloworld extends CI_Controller {
function display()
{
$this->load->view('display_view');
}
}
?>


Step 2 : Creating View

Create a View with the filename "display_view.php" within "<root folder>/application/views" folder and write the following code in that file.

Hello World!


Step 3: Run the Hello World application

Now run the above Hello World application by entering

"http://localhost/CodeIgniter/index.php/Helloworld/display" in the browser.

http://localhost/CodeIgniter/ --------> CodeIgniter root path
Helloworld  -------------> Controller name
display ---------> View name

Comments · 3

?
Anonymous
7 January 2015 at 12:53
Awsome
?
Unknown
28 September 2016 at 05:03
NICE TUTORIAL
?
Unknown
28 September 2016 at 05:03
Awesome tutorial for beginners

Post a Comment