Basecoat\View::processTemplate PHP Method

processTemplate() public method

Load and process a content template, optionally parse content blocks into namespaces
public processTemplate ( String $tpl, boolean $parse = true ) : String
$tpl String template file to include
$parse boolean whether to parse the template blocks into namespaces (default true)
return String the processed template or the number of content blocks parsed
    public function processTemplate($tpl, $parse = true)
    {
        if (file_exists($this->templates_path . $tpl)) {
            $tpl = $this->templates_path . $tpl;
        }
        if (!file_exists($tpl)) {
            return -1;
        }
        ob_start();
        include $tpl;
        $content = ob_get_clean();
        $this->replaceDataTags($content);
        if ($parse) {
            return $this->parseBlocks($content);
        } else {
            return $content;
        }
    }