Creating views in Codeigniter
A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc. Views are stored in application/views/ directory. Let’s create a view.
Example (first.php) The view file
<html> <head> <title>My first view</title> </head> <body> <h1>Welcome to my first view</h1> </body> </html>
Example (Hello.php) The Controller file
<?php class Hello extends CI_Controller { public function index() { $this->load->view('first'); } }
Output
URL : http://localhost/myApp/index.php/Hello
Output : Welcome to my first view