Example #1
0
 public function getTemplateVarCategoryCms()
 {
     $categoryCms = array();
     $categoryCms['cms_category'] = $this->objectPresenter->present($this->cms_category);
     $categoryCms['sub_categories'] = array();
     $categoryCms['cms_pages'] = array();
     foreach ($this->cms_category->getSubCategories($this->context->language->id) as $subCategory) {
         $categoryCms['sub_categories'][$subCategory['id_cms_category']] = $subCategory;
         $categoryCms['sub_categories'][$subCategory['id_cms_category']]['link'] = $this->context->link->getCMSCategoryLink($subCategory['id_cms_category'], $subCategory['link_rewrite']);
     }
     foreach (CMS::getCMSPages($this->context->language->id, (int) $this->cms_category->id, true, (int) $this->context->shop->id) as $cmsPages) {
         $categoryCms['cms_pages'][$cmsPages['id_cms']] = $cmsPages;
         $categoryCms['cms_pages'][$cmsPages['id_cms']]['link'] = $this->context->link->getCMSLink($cmsPages['id_cms'], $cmsPages['link_rewrite']);
     }
     return $categoryCms;
 }
Example #2
0
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $parent_cat = new CMSCategory(1, $this->context->language->id);
     $this->context->smarty->assign('id_current_lang', $this->context->language->id);
     $this->context->smarty->assign('home_title', $parent_cat->name);
     $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID'));
     if ($this->assignCase == 1) {
         if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category) {
             $path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS');
         } elseif (isset($this->cms_category->meta_title)) {
             $path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS');
         }
         $this->context->smarty->assign(array('cms' => $this->cms, 'content_only' => (int) Tools::getValue('content_only'), 'path' => $path, 'body_classes' => array($this->php_self . '-' . $this->cms->id, $this->php_self . '-' . $this->cms->link_rewrite)));
         if ($this->cms->indexation == 0) {
             $this->context->smarty->assign('nobots', true);
         }
     } elseif ($this->assignCase == 2) {
         $this->context->smarty->assign(array('category' => $this->cms_category, 'cms_category' => $this->cms_category, 'sub_category' => $this->cms_category->getSubCategories($this->context->language->id), 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int) $this->cms_category->id, true, (int) $this->context->shop->id), 'path' => $this->cms_category->id !== 1 ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', 'body_classes' => array($this->php_self . '-' . $this->cms_category->id, $this->php_self . '-' . $this->cms_category->link_rewrite)));
     }
     $this->setTemplate(_PS_THEME_DIR_ . 'cms.tpl');
 }