Returns template source code.
public getContent ( $file ) : string | ||
return | string |
public function getContent($file) { $content = parent::getContent($file); $compiler = new Compiler(); $compiled = $compiler->compile($content); return $compiled; }
/** * @param $file * @return mixed|string */ public function getContent($file) { $ext = pathinfo(strval($file), PATHINFO_EXTENSION); $content = filter('content', parent::getContent($file), $file, $ext); // Try render page if ($file instanceof Page) { /** @var Page $file */ if ($ext === 'html' && substr($content, 0, 15) === '<!doctype html>') { return $content; } if ($ext === 'md') { $content = '{block|md}' . $content . '{/block}'; } if (strpos($content, '{block content') === false) { $content = '{block content}' . $content . '{/block}'; } if (strpos($content, '{layout') === false) { $content = "{layout '{$file->template}'}" . $content; } } //echo '<pre>' . htmlentities($content);die(); // debug return $content; }
/** * @param string $file * @return string */ public function getContent($file) { $content = parent::getContent($file); $compiled = $this->compile($content); return $compiled; }