toutpratique/controllers/front/CategoryCmsController.php

36 lines
968 B
PHP
Raw Normal View History

<?php
require_once _MODULE_DIR_.'cmsps/classes/CmsPsCategory.php';
class CategoryCmsControllerCore extends FrontController
{
2015-07-09 15:38:06 +02:00
public $php_self = 'categorycms';
public $categorycms;
public function canonicalRedirection($canonical_url = '') {
2015-07-09 15:38:06 +02:00
parent::canonicalRedirection($this->context->link->getCategoryCmsLink($this->categorycms->id));
}
public function init() {
2015-07-09 15:38:06 +02:00
$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)) {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
}
parent::init();
}
public function initContent() {
parent::initContent();
$this->context->smarty->assign(array(
2015-07-09 15:38:06 +02:00
'path' => Tools::getPath($this->categorycms->id, '', FALSE, 'categoriescms'),
'categorycms' => $this->categorycms
));
$this->setTemplate(_PS_THEME_DIR_.'categorycms.tpl');
}
}