Login +

Controllers / Statics Pattern

The party Statics list the statics controllers.

A Static Controller is a Controller that is running on the whole application automatically.

It helps to develop a single time global behaviors in the application.

In the example, we choose a Static Controller Menu.

The tree is as follows:

The structure of a Static Controller is as follows:

<?php
/**
 * Controller Static MenuController
 *
 * @author SillySmart
 * @copyright SillySmart
 * @package Mvc.Controllers.Statics.MenuController
 * @see Sls.Controllers.Core.SLS_FrontStatic
 * @since 1.0
 */
class MenuController extends SLS_FrontStatic implements SLS_IStatic
{

    public function __construct()
    {
        parent::__construct(true);
    }

    public function constructXML()
    {
        // Write here all your instructions to make your Static configuration with xml by $this->_xmlToolBox
    }

}
?>

The code of your Static Controller will thus be written in constructXML() function.

Related :

References

  1. SLS_FrontStatic - Controller FrontStatic - Father's controller of each Statics Controllers