Exemple #1
0
 /**
  * Render view. Twig views are rendered within layout.
  *
  * @param array $vars 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;
 }
Exemple #2
0
 /**
  * Set input file path. Overriden to update processor options.
  *
  * @param string $file Path to file
  *
  * @return \Phrekyll\Site\View
  */
 public function setInputFile($path)
 {
     parent::setInputFile($path);
     $processors = $this->getProcessors();
     if (count($processors)) {
         $options = array('phr_template_filename' => basename($path), 'phr_template_dir' => dirname($path));
         $processor = array_pop($processors);
         $processor->setConfig($options);
     }
     return $this;
 }
Exemple #3
0
 /**
  * Initialize view
  *
  * @param string $inputFile Path to view source file
  * @param string $outputDir File destination path
  *
  * @return \Phrekyll\Site\View
  */
 public function __construct($inputFile = null, $outputDir = null)
 {
     parent::__construct($inputFile, $outputDir);
     $this->addProcessor(new \Phrekyll\Processor\Plain());
 }
Exemple #4
0
 /**
  * Render view. Twig views are rendered within layout.
  *
  * @param array $vars List of variables passed to text processors
  *
  * @return string
  */
 public function render($vars = array())
 {
     return parent::render($vars);
 }