42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
require_once _PS_MODULE_DIR_.'cmsps/classes/CmsPsPost.php';
|
|
require_once _PS_MODULE_DIR_.'cmsps/classes/CmsPsCategory.php';
|
|
|
|
class CategoryCmsControllerCore extends FrontController
|
|
{
|
|
public $php_self = 'categorycms';
|
|
public $categorycms;
|
|
|
|
public function canonicalRedirection($canonical_url = '') {
|
|
parent::canonicalRedirection($this->context->link->getCategoryCmsLink($this->categorycms->id));
|
|
}
|
|
|
|
public function init() {
|
|
$id_category_cms = Tools::getValue('id_category_cms', 0);
|
|
$this->categorycms = new CmsPsCategory($id_category_cms, $this->context->language->id);
|
|
|
|
if (!Validate::isLoadedObject($this->categorycms)
|
|
|| !$this->categorycms->active) {
|
|
header('HTTP/1.1 404 Not Found');
|
|
header('Status: 404 Not Found');
|
|
}
|
|
parent::init();
|
|
}
|
|
|
|
public function initContent() {
|
|
parent::initContent();
|
|
$id_lang = Context::getContext()->language->id;
|
|
|
|
$tipsDay = CmsPsCategory::getTipsofDay($this->categorycms->id, $id_lang);
|
|
|
|
$this->context->smarty->assign(array(
|
|
'path' => Tools::getPath($this->categorycms->id, '', FALSE, 'categoriescms'),
|
|
'categorycms' => $this->categorycms,
|
|
'tipsDay' => $tipsDay
|
|
));
|
|
|
|
$this->setTemplate(_PS_THEME_DIR_.'categorycms.tpl');
|
|
}
|
|
|
|
} |