PHP 8.6.0 Beta 3 is available for testing

Yaf_Dispatcher::initView

(Yaf >=1.0.0)

Yaf_Dispatcher::initViewInitialize view and return it

Опис

public function Yaf_Dispatcher::initView(string $templates_dir, ?array $options = null): Yaf_View_Interface|null|false

Initialize and return a Yaf_View_Simple instance bound to the dispatcher, using the given template directory.

Параметри

templates_dir

The directory that holds the view templates.

options

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

Значення, що повертаються

A Yaf_View_Interface instance on success, or false / null on failure.

Приклади

Приклад #1 Yaf_Dispatcher::initView() example

<?php
$app = new Yaf_Application(dirname(__FILE__) . "/conf/application.ini");

$view = Yaf_Dispatcher::getInstance()->initView(
    dirname(__FILE__) . "/application/views",
    array("tpl_suffix" => ".html")
);

$view->assign("title", "Home");
?>

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top