Yaf_View_Simple::setScriptPath

(Yaf >=1.0.0)

Yaf_View_Simple::setScriptPathSet the template directory

Description

public function Yaf_View_Simple::setScriptPath(string $template_dir): Yaf_View_Simple

Sets the directory in which templates are looked up.

Parameters

template_dir

The directory where the template scripts are stored.

Return Values

Returns the view instance, or false if template_dir is not an absolute path.

Examples

Example #1 Yaf_View_Simple::setScriptPath() example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        /* render templates from another directory */
        $this->getView()->setScriptPath(APPLICATION_PATH . "/modules/admin/views");

        $this->getView()->display("dashboard/index.phtml");

        return false; // we rendered ourselves, skip auto-rendering
    }
}
?>

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.