interface View_Interface (View source)

Yaf provides a ability for developers to use custom view engine instead of build-in engine which is \Yaf\View\Simple. There is a example to explain how to do this, please see \Yaf\Dispatcher::setView()

Methods

bool
assign(string|array $name, mixed $value)

Assign values to View engine, then the value can access directly by name in template.

bool
display(string $tpl, array $tpl_vars = null)

Render a template and output the result immediately.

string
getScriptPath()

No description

string
render(string $tpl, array $tpl_vars = null)

Render a template and return the result.

setScriptPath(string $template_dir)

Set the templates base directory, this is usually called by \Yaf\Dispatcher

Details

bool assign(string|array $name, mixed $value)

Assign values to View engine, then the value can access directly by name in template.

Parameters

string|array $name
mixed $value

Return Value

bool

bool display(string $tpl, array $tpl_vars = null)

Render a template and output the result immediately.

Parameters

string $tpl
array $tpl_vars

Return Value

bool

string getScriptPath()

No description

Return Value

string

string render(string $tpl, array $tpl_vars = null)

Render a template and return the result.

Parameters

string $tpl
array $tpl_vars

Return Value

string

setScriptPath(string $template_dir)

Set the templates base directory, this is usually called by \Yaf\Dispatcher

Parameters

string $template_dir

An absolute path to the template directory, by default, \Yaf\Dispatcher use application.directory . "/views" as this parameter.