Yaf_Controller_Abstract::setViewpath

(Yaf >=1.0.0)

Yaf_Controller_Abstract::setViewpathSet the view path

Description

public function Yaf_Controller_Abstract::setViewpath(string $view_directory): ?bool

Sets the template directory of the view engine bound to this controller.

Parameters

view_directory

The directory that holds the view templates.

Return Values

Returns true on success, or false / null on failure.

Examples

Example #1 Yaf_Controller_Abstract::setViewpath() example

<?php
class ProductController extends Yaf_Controller_Abstract
{
    public function init() {
        // from now on templates of this controller are looked up
        // under application/themes/dark/views/
        $this->setViewpath(APPLICATION_PATH . "/themes/dark/views");
    }

    public function indexAction() {
        // renders application/themes/dark/views/product/index.phtml
        $this->display("product/index.phtml");
    }
}
?>

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.