CodeIgniter View




  1. A view is a web page that display all the elements of User Interface. View deals with the fronted operations. View display data and capture user action. View send user action to controller. Location of  all view files is applications/views.

View could not be called directly. You need to load the view through controller.

How to create view

Create a HTML page and name it firstview.php. Save this file inside  applications/views.
Code of the firstview.php file.

Load the view

View will be load through controller.  Syntax for loading view will be :

For our case syntax will be :

Load multiple views in Controller

You can also create a new folder inside application/view and save your files in this folder.

Sort views in Subfolders

You can  sort views within subfolders:

Pass Dynamic Data to view

Data can be transfer from controller to view by using an array or object.



View will be look like this :