src/WingCommander.php
public function render ($filename, $vars = array(), $toVar = null)
    {
        $templatePath = $this->templatePath . '/' . $filename . '.' . $this->templateExtension;

        if (file_exists($templatePath)) {

            $template = file_get_contents($templatePath);
            $output = parent::render($template, array_merge($this->vars, $vars));

            if ($toVar) {
                $this->set($toVar, $output);
            } else {
                echo $output;
            }

        } else {

            throw new Exception ("Template '$filename' could not be found.");

        }
    }
public function render ($filename, $vars = array(), $toVar = null)
    {
        $templatePath = $this->templatePath . '/' . $filename . '.' . $this->templateExtension;

        if (file_exists($templatePath)) {

            $template = file_get_contents($templatePath);
            $output = parent::render($template, array_merge($this->vars, $vars));

            if ($toVar) {
                $this->set($toVar, $output);
            } else {
                echo $output;
            }

        } else {

            throw new Exception ("Template '$filename' could not be found.");

        }
    }
Render a page

@param string      $filename Filename
@param array       $vars     Variables
@param string|null $toVar    If specified, it will save as a variable rather than output

@return void