getContent() public method

Returns template source code.
public getContent ( $file ) : string
return string
Example #1
0
 public function getContent($file)
 {
     $content = parent::getContent($file);
     $compiler = new Compiler();
     $compiled = $compiler->compile($content);
     return $compiled;
 }
Example #2
0
 /**
  * @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;
 }
Example #3
0
 /**
  * @param string $file
  * @return string
  */
 public function getContent($file)
 {
     $content = parent::getContent($file);
     $compiled = $this->compile($content);
     return $compiled;
 }