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::initYaf_Controller_Abstract::redirect>
^Yaf_Controller_AbstractLast updated: Mon, 26 Oct 2026

Yaf_Controller_Abstract::initView

(Yaf >=1.0.0)

Yaf_Controller_Abstract::initView — Initialize the view and return it

Description

public function Yaf_Controller_Abstract::initView(?array $options = ?): ?Yaf_View_Interface

Returns the view engine bound to this controller. The view engine is initialized by the Yaf_Dispatcher during dispatching, using the template path set for the current controller.

Parameters

options

Options passed to the view engine, see Yaf_View_Simple::__construct().

Return Values

A Yaf_View_Interface instance on success, or null on failure.

Examples

Example #1 Yaf_Controller_Abstract::initView() example

<?php
class ProductController extends Yaf_Controller_Abstract
{
    public function indexAction() {
        // fetch the view engine bound to this controller, initialized
        // with its template path, e.g. application/views/;
        // options would be forwarded to the view engine, see
        // Yaf_View_Simple::__construct()
        $view = $this->initView();
        $view->assign("products", array("yaf", "php"));
    }
}
?>

See Also


<Yaf_Controller_Abstract::initYaf_Controller_Abstract::redirect>
^Yaf_Controller_AbstractLast updated: Mon, 26 Oct 2026