Codeigniter Views - phptpoint

Codeigniter Views



The view is a simple webpage(designing page) which called by Controller.
The view may contain Navbar, Header, Footer, Sidebar, slider etc.
The view(designing page) can’t access directly it always called by Controller.
Lets create a simple view page and call on a Controller’s method.


Save this file inside Application/views/about.php.

loading view on a controller

The view can be loaded on a controller following syntax :

Sometimes we can create different directly like user, admin etc. inside user directory we may store header, footer,sidebar for users
same as admin inside admin directory, in this case we can call like :

Calling view on a Controller

Add a new mehtod about() on Hello Controller Application/controllers/Hello.php.

Here Hello Controller has now 2 methods. One is index() that contains “Hello World” message only.
Second method about() is calling about.php view page.
Note : inside Controller no need to call page extension of view.

Calling about() method of Hello Controller