Yaf_Controller_Abstract::setViewpath

Set the view path

Description

public boolnull Yaf_Controller_Abstract::setViewpath(string $view_directory)

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

  • Yaf_Controller_Abstract::getViewpath