Ejemplo n.º 1
0
 public function initContent($full_url, $sectionName, $tagName)
 {
     $this->requestURI = $this->apacheRewriteUsed ? $full_url : false;
     // seciton ...
     $this->sections = BertaContent::getSections();
     if (!$sectionName || empty($this->sections[$sectionName])) {
         if ($this->environment == 'engine') {
             list($sectionName, ) = each($this->sections);
         } else {
             foreach ($this->sections as $sName => $s) {
                 if (!empty($s['@attributes']['published'])) {
                     $sectionName = $sName;
                     break;
                 }
             }
         }
     }
     $this->sectionName = $sectionName;
     // content ...
     $this->content = BertaContent::loadBlog($sectionName);
     $this->allContent = array($this->sectionName => $this->content);
     //var_dump($this->sectionName, $this->sections[$this->sectionName]['get_all_entries_by_section']);
     if (!empty($this->sections[$this->sectionName]['get_all_entries_by_section']) && $this->sections[$this->sectionName]['get_all_entries_by_section']['value'] == 'yes') {
         foreach ($this->sections as $sName => $s) {
             if ($this->sectionName != $sName) {
                 $this->allContent[$sName] = BertaContent::loadBlog($sName);
             }
         }
     }
     //BertaEditor::populateSubSections($this->sectionName, $this->content);
     // subsections ...
     $this->tags = BertaContent::getTags();
     $this->tagName = $tagName;
     if (!isset($this->tags[$this->sectionName][$this->tagName])) {
         $this->tagName = false;
     }
     // in the engine mode one can view all entries for a section, even if the section has subsections
     // but in the front-ends mode, if there are subsections, the first of them is automatically selected.
     if ($this->environment != 'engine' && !empty($this->tags[$this->sectionName]) && empty($this->tagName) && empty($this->sections[$this->sectionName]['@attributes']['has_direct_content']) && $this->settings->get('navigation', 'alwaysSelectTag') == 'yes') {
         $this->tagName = reset(array_keys($this->tags[$this->sectionName]));
     }
     // tags ....
     /*$this->tags = BertaContent::getTags($sectionName);
     		//asort($this->tags);
     		$this->tagName = $tagName;
     		if(!isset($this->tags[$this->tagName])) $this->tagName = false;*/
     // template ...
     $this->template->addContent($this->requestURI, $this->sectionName, $this->sections, $this->tagName, $this->tags, $this->content, $this->allContent);
 }