本文整理汇总了PHP中CMSCategory::getSubCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSCategory::getSubCategories方法的具体用法?PHP CMSCategory::getSubCategories怎么用?PHP CMSCategory::getSubCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSCategory
的用法示例。
在下文中一共展示了CMSCategory::getSubCategories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplateVarCategoryCms
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;
}
示例2: initContent
/**
* 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');
}