php8.5
Home/ Manual/ yaf / yaf_controller_abstract/ Yaf_Controller_Abstract::getViewpath

Yaf_Controller_Abstract::getViewpath

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Get the view path

Description

Yaf_Controller_Abstract::getViewpath(): string|null

Returns the template directory used by the view engine bound to this controller.

Parameters Parameters

Return Values

The view template directory as a String.

Examples

Yaf_Controller_Abstract::getViewpath example

php
<?php
class ProductController extends Yaf_Controller_Abstract
{
    public function indexAction() {
        // the template directory used by the view engine,
        // e.g. "/var/www/html/application/views"
        var_dump($this->getViewpath());
    }
}
?>

The above example will output something similar to:

output
string(31) "/var/www/html/application/views"

See Also

  • Yaf_Controller_Abstract::setViewpath
  • Yaf_Controller_Abstract::initView

Source: reference/yaf/yaf_controller_abstract/getviewpath.xml · from the official PHP manual (php/doc-en)