Login +

Reference Guide / SLS_GenericController

SLS_GenericController1 is the parent class of every Controller, it contains methods for loading generic Model, the information of the current page, and routing interfaces of the application.


At Controller level, youaccess it directlyby thekeyword $this:


Model loading

To load and use a Model of your choice, simply use the useModel() function:


Parameter $model must contain the name of the Model to use, $db the alias of the database on which is located the table. If it is omitted, the default database will be used.


To dynamically change the metas of the current action, you can use a number of functions setMeta…($value, $incremental=false):


You can concatenate the existing meta (set during the creation of the action), with a new value:

$this->setMetaTitle($titleMore, true);


- To redirect to a Controller / Action site, you can use the forward() function:

$this->forward($controller, $action, $params=array(), $lang="");

$params is a multiple array allowing you to spend many additional parameters to the application as necessary:

$params = array(array("key" => $key, "value" => $value));

- To redirect to a free url, you can use the redirect() function:


- To dispatch the application on a Controller / Action without reloading the page or change the url, use the dispatch() function:

$this->dispatch($controller, $action, $params=array());

Related :


  1. SLS_GenericController - Controller Generic - Father's controller of each Actions Controllers