Phrozn\Site\View\Twig::render PHP Method

render() public method

Render view. Twig views are rendered within layout.
public render ( array $vars = [] ) : string
$vars array List of variables passed to text processors
return string
    public function render($vars = array())
    {
        $view = parent::render($vars);
        if ($this->hasLayout()) {
            // inject global site and front matter options into template
            $vars = array_merge_recursive($vars, $this->getParams());
            $view = $this->applyLayout($view, $vars);
        }
        return $view;
    }

Usage Example

Example #1
0
    public function testNoSourcePathSpecified()
    {
        $this->setExpectedException('Exception', "View input file not specified");
        $view = new View();

        $rendered = $view->render(array());

    }