示例#1
0
 /**
  * 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);
 }