/** * Parse the template or if $section is set and the section exists, parse the specified section * @param string $section */ public function parse($section = NULL) { $oldSearchpath = One_Script_Factory::getSearchPath(); One_Script_Factory::clearSearchpath(); One_Script_Factory::setSearchPath($this->getSearchPath()); if ($this->useFile()) { $this->nScript->load($this->getFile()); $this->nScript->select($section); if (!$this->nScript->isError()) { $output = $this->nScript->execute($this->getData()); } } else { $this->nScript->select($section); $output = $this->nScript->executeString($this->getContent(), $this->getData()); } One_Script_Factory::clearSearchpath(); One_Script_Factory::setSearchPath($oldSearchpath); One_Script_Content_Factory::$nsContentCache = array(); if ($this->nScript->isError()) { throw new One_Exception($this->nScript->error); } return trim($output); }
/** * Parse the template or if $section is set and the section exists, parse the specified section * * @param string $section */ public function render($section = null) { $oldSearchpath = One_Script_Factory::getSearchPath(); One_Script_Factory::setSearchPath($this->getSearchPath()); if ($this->useFile()) { $this->script->load($this->getFile()); if ($section !== null) { $this->script->select($section); } if (!$this->script->isError()) { $output = $this->script->execute($this->getData()); } } else { $this->script->select($section); $output = $this->script->executeString($this->getContent(), $this->getData()); } One_Script_Factory::setSearchPath($oldSearchpath); One_Script_Content_Factory::clearContentCache(); // *** why is this here ? WTF ! if ($this->script->isError()) { throw new One_Exception_Script($this->script->error); } return trim($output); }