Login +

Controllers / Actions Patterns

Actions list the Controllers of the application and all actions within Controller following running URL Rewrite:


The tree is as follows:

Some explanations on the above structure:

  • Directory « Blog » represents the Controller of the same name.
  • File « Index.controller.php » represents the action"Index" in the Controller "Blog".
  • File « __Blog.protected.php » is a class responsible for all actions of the Controller "Blog".
  • File « __site.protected.php » is a class responsible for the entire site.

The file"__ Blog.protected.php" creates redundant functions in the scope of a Controller.

The file"__ site.protected.php" creates redundant functions in the global scope of the application.

The structure of the action is:

 * Class Index into Blog Controller
 * @author SillySmart
 * @copyright SillySmart
 * @package Mvc.Controllers.Blog
 * @see Mvc.Controllers.Blog.ControllerProtected
 * @see Mvc.Controllers.SiteProtected
 * @see Sls.Controllers.Core.SLS_GenericController
 * @since 1.0
class BlogIndex extends BlogControllerProtected
    public function init()

    public function action()

The code of your action will thus be written in the action() action.

The init() function is always called before the execution of action().

She called a same init() function at the controller level that calls itself an init() function at the application level.

This allows to relocate madatories treatments to a Controller or the entire application.

For example, a Controller "Back Office" where there's need to be authenticated, we could do various checks in the init() function of the Controller, the latter being called by the Controller of all actions.

Related :