php8.5
Home/ Manual/ yaf / yaf_controller_abstract/ Yaf_Controller_Abstract::getView

Yaf_Controller_Abstract::getView

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Retrieve the view engine

Description

Yaf_Controller_Abstract::getView(): Yaf_View_Interface|null

Returns the view engine bound to this controller.

Parameters Parameters

Return Values

A Yaf_View_Interface instance, or null if no view engine is available.

Examples

Yaf_Controller_Abstract::getView example

php
<?php
class ProductController extends Yaf_Controller_Abstract
{
    public function indexAction() {
        $view = $this->getView();

        // export $products to the template product/index.phtml
        $view->assign("products", array("yaf", "php"));
    }
}
?>

See Also

  • Yaf_Controller_Abstract::initView
  • Yaf_View_Interface

Source: reference/yaf/yaf_controller_abstract/getview.xml · from the official PHP manual (php/doc-en)