Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_Controller_Abstract::getViewpathYaf_Controller_Abstract::initView>
^Yaf_Controller_AbstractLast updated: Mon, 26 Oct 2026

Yaf_Controller_Abstract::init

(Yaf >=1.0.0)

Yaf_Controller_Abstract::init — Controller initializer

Description

public function Yaf_Controller_Abstract::init(): void

Yaf_Controller_Abstract::__construct() is not meant to be overridden with custom logic, so Yaf_Controller_Abstract::init() is provided as the userland initialization hook. If it is defined in a controller, it is called right after the controller object is instantiated.

Parameters

This function has no parameters.

Return Values

No value is returned.

Examples

Example #1 Yaf_Controller_Abstract::init() example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    // init() is called right after the controller is instantiated,
    // before any action is dispatched
    public function init() {
        $this->getView()->assign("sitename", "Yaf Tutorial");
    }

    public function indexAction() {
        // ...
    }
}
?>

See Also


<Yaf_Controller_Abstract::getViewpathYaf_Controller_Abstract::initView>
^Yaf_Controller_AbstractLast updated: Mon, 26 Oct 2026