/** * Parse a widget straight from the template, rather than adding it through pages. * * @param string $var The variable. * @param string $module The module whose module we want to execute. * @param string $action The action to execute. * @param string $id The widget id (saved in data-column). */ public static function parseWidget($var, $module, $action, $id = null) { $data = $id !== null ? serialize(array('id' => $id)) : null; // create new widget instance and return parsed content $extra = new FrontendBlockWidget($module, $action, $data); $extra->execute(); return $extra->getContent(); }
/** * 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']); } } }