/** * Render a template * * @param string $source A fully qualified template url or content string * @param array $data An associative array of data to be extracted in local template scope * @throws \InvalidArgumentException If the template could not be located * @throws \RuntimeException If a partial template url could not be fully qualified * @throws \RuntimeException If the template could not be loaded * @throws \RuntimeException If the template could not be compiled * @return string The rendered template source */ public function render($source, array $data = array()) { $source = parent::render($source, $data); //Load the template if ($this->getObject('filter.path')->validate($source)) { $source_file = $this->locateSource($source); if (!($cache_file = $this->isCached($source_file))) { $source = $this->loadSource($source_file); $source = $this->compileSource($source); $cache_file = $this->cacheSource($source_file, $source); } } else { $name = crc32($source); $source_file = ''; if (!($cache_file = $this->isCached($name))) { $source = $this->compileSource($source); $cache_file = $this->cacheSource($name, $source); } } //Evaluate the template $result = $this->evaluateSource($cache_file); //Render the debug information $result = $this->renderDebug($result); return $result; }
/** * Render a template * * @param string $source The template path or content * @param array $data An associative array of data to be extracted in local template scope * @throws \RuntimeException If the template could not be loaded * @return string The rendered template */ public function render($source, array $data = array()) { parent::render($source, $data); //Let mustache load the template by proxiing through the load() method. $result = $this->_mustache->render($source, $data); //Render the debug information return $this->renderDebug($result); }
/** * Render a template * * @param string $source The template url or content * @param array $data An associative array of data to be extracted in local template scope * @throws \RuntimeException If the template could not be loaded * @return string The rendered template source */ public function render($source, array $data = array()) { parent::render($source, $data); //Let twig load the content by proxiing through the getSource() method. $result = $this->_twig->render($source, $data); //Render the debug information return $this->renderDebug($result); }