Ejemplo n.º 1
0
 public function loadTemplate()
 {
     PHPWS_Core::initCoreClass('XMLParser.php');
     $xml = new XMLParser($this->file);
     $xml->setContentOnly(true);
     if (PHPWS_Error::isError($xml->error)) {
         return $xml->error;
     }
     $result = $xml->format();
     if (empty($result['TEMPLATE'])) {
         return;
     }
     $this->data = $result['TEMPLATE'];
     if (!isset($this->data['TITLE'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_TITLE, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->title =& $this->data['TITLE'];
     if (isset($this->data['SUMMARY'])) {
         $this->summary =& $this->data['SUMMARY'];
     }
     if (empty($this->data['THUMBNAIL'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_TN, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->thumbnail =& $this->data['THUMBNAIL'];
     if (isset($this->data['STYLE'])) {
         $this->style =& $this->data['STYLE'];
     }
     if (empty($this->data['STRUCTURE']['SECTION'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_SECTIONS, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->structure =& $this->data['STRUCTURE']['SECTION'];
     if (isset($this->data['FOLDERS'])) {
         if (is_array($this->data['FOLDERS']['NAME'])) {
             $this->folders =& $this->data['FOLDERS']['NAME'];
         } else {
             $this->folders = array($this->data['FOLDERS']['NAME']);
         }
     }
 }