Saturday, November 10, 2012

Controller, Model and View in Codeigniter



1.Controller

Controller will determine an HTTP request to be handled where the controller is a class that can be called in the URL. If we call our controller then CodeIgniter will look for the controller with the controller name is what we mean and then CodeIgniter will meloadnya.

2. Model

The model is made ​​to relate class in the database. Models saved in the application / models /.
The structure of the model is:

Class extends Model {ModelName
ModelName function () {
Parent :: Model ();
}
}

To call it a model called from the controller to the function:

$ this-> load-> model ('ModelName');

3. View

View a display on a web page. Loading the view is done by the function:

$ this-> load-> view ('viewname');

In codeigniter also do call some view of the controller just by adding a call to the desired view.

1 comment: