Exemple #1
0
 /**
  * Processes the page
  */
 protected function processPage()
 {
     // set pageTitle
     $this->header->setPageTitle($this->record['meta_title'], (bool) ($this->record['meta_title_overwrite'] == 'Y'));
     // set meta-data
     $this->header->addMetaDescription($this->record['meta_description'], (bool) ($this->record['meta_description_overwrite'] == 'Y'));
     $this->header->addMetaKeywords($this->record['meta_keywords'], $this->record['meta_keywords_overwrite'] == 'Y');
     $this->header->setMetaCustom($this->record['meta_custom']);
     // advanced SEO-attributes
     if (isset($this->record['meta_data']['seo_index'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_index']));
     }
     if (isset($this->record['meta_data']['seo_follow'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_follow']));
     }
     // create navigation instance
     new FrontendNavigation();
     // assign content
     $this->tpl->assign('page', $this->record);
     // set template path
     $this->templatePath = FRONTEND_PATH . '/' . $this->record['template_path'];
     // loop blocks
     foreach ($this->record['positions'] as $position => &$blocks) {
         // position not known in template = skip it
         if (!in_array($position, $this->record['template_data']['names'])) {
             continue;
         }
         // loop blocks in position
         foreach ($blocks as $index => &$block) {
             // build templateVariable
             $templateVariable = 'block' . ($index + 1);
             // an extra
             if ($block['extra_id'] !== null) {
                 // block
                 if ($block['extra_type'] == 'block') {
                     // create new instance
                     $extra = new FrontendBlockExtra($block['extra_module'], $block['extra_action'], $block['extra_data']);
                 } else {
                     // create new instance
                     $extra = new FrontendBlockWidget($block['extra_module'], $block['extra_action'], $block['extra_data']);
                 }
                 // add to list of extras
                 $block = array('extra' => $extra);
                 // add to list of extras to parse
                 $this->extras[] = $extra;
             } else {
                 $block = array('blockIsHTML' => true, 'blockContent' => $block['html']);
             }
         }
     }
 }
Exemple #2
0
 /**
  * Execute the action
  * If a javascript file with the name of the module or action exists it will be loaded.
  */
 public function execute()
 {
     // build path to the module
     $frontendModulePath = FRONTEND_MODULES_PATH . '/' . $this->getModule();
     // buil URL to the module
     $frontendModuleURL = '/frontend/modules/' . $this->getModule() . '/js';
     // add javascriptfile with same name as module (if the file exists)
     if (SpoonFile::exists($frontendModulePath . '/js/' . $this->getModule() . '.js')) {
         $this->header->addJS($frontendModuleURL . '/' . $this->getModule() . '.js', false, true);
     }
     // add javascriptfile with same name as the action (if the file exists)
     if (SpoonFile::exists($frontendModulePath . '/js/' . $this->getAction() . '.js')) {
         $this->header->addJS($frontendModuleURL . '/' . $this->getAction() . '.js', false, true);
     }
 }
Exemple #3
0
 /**
  * Processes the page
  *
  * @return	void
  */
 private function processPage()
 {
     // is this an action?
     $isAction = isset($this->record['data']['is_action']) && $this->record['data']['is_action'];
     // only set title and meta-stuff if this isn't an action
     if (!$isAction) {
         // set pageTitle
         $this->header->setPageTitle($this->record['meta_title'], (bool) ($this->record['meta_title_overwrite'] == 'Y'));
         // set meta-data
         $this->header->addMetaDescription($this->record['meta_description'], (bool) ($this->record['meta_description_overwrite'] == 'Y'));
         $this->header->addMetaKeywords($this->record['meta_keywords'], $this->record['meta_keywords_overwrite'] == 'Y');
         $this->header->setMetaCustom($this->record['meta_custom']);
     }
     // advanced SEO-attributes
     if (isset($this->record['meta_data']['seo_index'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_index']));
     }
     if (isset($this->record['meta_data']['seo_follow'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_follow']));
     }
     // create breadcrumb instance
     $this->breadcrumb = new FrontendBreadcrumb();
     // create navigation instance
     new FrontendNavigation();
     // new footer instance
     $this->footer = new FrontendFooter();
     // assign content
     $this->tpl->assign('page', $this->record);
     // set template path
     $this->templatePath = FRONTEND_PATH . '/' . $this->record['template_path'];
     // loop blocks
     foreach ($this->record['blocks'] as $index => $block) {
         // get blockName
         $blockName = isset($this->record['template_data']['names'][$index]) ? $this->record['template_data']['names'][$index] : null;
         // unknown blockname? skip it
         if ($blockName === null) {
             continue;
         }
         // build templateVariable
         $templateVariable = 'block' . ($index + 1);
         // an extra
         if ($block['extra_id'] !== null) {
             // block
             if ($block['extra_type'] == 'block') {
                 // create new instance
                 $extra = new FrontendBlockExtra($block['extra_module'], $block['extra_action'], $block['extra_data']);
                 // execute
                 $extra->execute();
                 // overwrite the template
                 if ($extra->getOverwrite()) {
                     $this->templatePath = $extra->getTemplatePath();
                 } else {
                     $this->extras[$templateVariable] = $extra;
                 }
                 // assign the variables from this block to the main template
                 $this->tpl->assignArray((array) $extra->getTemplate()->getAssignedVariables());
             } else {
                 // create new instance
                 $extra = new FrontendBlockWidget($block['extra_module'], $block['extra_action'], $block['extra_data']);
                 // fetch data (if available)
                 $extra->execute();
                 // assign the variables from this widget to the main template
                 $this->tpl->assignArray((array) $extra->getTemplate()->getAssignedVariables());
                 // add to list of blocks
                 $this->extras[$templateVariable] = $extra;
             }
         } else {
             // assign option
             $this->tpl->assign($templateVariable . 'IsHTML', true);
             // assign HTML
             $this->tpl->assign($templateVariable, $block['html']);
         }
     }
 }