toutpratique/controllers/front/CategoryCmsController.php
2015-07-10 11:48:33 +02:00

37 lines
1003 B
PHP

<?php
require_once _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();
$this->context->smarty->assign(array(
'path' => Tools::getPath($this->categorycms->id, '', FALSE, 'categoriescms'),
'categorycms' => $this->categorycms
));
$this->setTemplate(_PS_THEME_DIR_.'categorycms.tpl');
}
}