VanillaController::initialize PHP Method

initialize() public method

Always called by dispatcher before controller's requested method.
Since: 2.0.0
public initialize ( )
    public function initialize()
    {
        // Set up head
        $this->Head = new HeadModule($this);
        $this->addJsFile('jquery.js');
        $this->addJsFile('jquery.form.js');
        $this->addJsFile('jquery.popup.js');
        $this->addJsFile('jquery.popin.js');
        $this->addJsFile('jquery.gardenhandleajaxform.js');
        $this->addJsFile('jquery.atwho.js');
        $this->addJsFile('global.js');
        $this->addCssFile('style.css');
        $this->addCssFile('vanillicon.css', 'static');
        // Add modules
        //      $this->addModule('MeModule');
        $this->addModule('GuestModule');
        $this->addModule('SignedInModule');
        parent::initialize();
    }

Usage Example

 public function initialize()
 {
     parent::initialize();
     /**
      * The default Cache-Control header does not include no-store, which can cause issues with outdated category
      * information (e.g. counts).  The same check is performed here as in Gdn_Controller before the Cache-Control
      * header is added, but this value includes the no-store specifier.
      */
     if (Gdn::session()->isValid()) {
         $this->setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
     }
 }
All Usage Examples Of VanillaController::initialize
VanillaController