July 17, 2013

July 17, 2013
3
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

3 comments: