2015-07-10 16:29:27 +02:00
|
|
|
<?php
|
|
|
|
|
2015-08-07 17:59:33 +02:00
|
|
|
require_once _PS_MODULE_DIR_.'cmsps/classes/CmsPsPost.php';
|
2015-07-10 16:29:27 +02:00
|
|
|
|
|
|
|
class PostCmsControllerCore extends FrontController
|
|
|
|
{
|
|
|
|
public $php_self = 'postcms';
|
|
|
|
public $postcms;
|
|
|
|
|
|
|
|
public function canonicalRedirection($canonical_url = '') {
|
|
|
|
parent::canonicalRedirection($this->context->link->getPostCmsLink($this->postcms->id));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function init() {
|
2015-08-12 14:41:06 +02:00
|
|
|
$id_post_cms = Tools::getValue('id_post_cms', 0);
|
2015-07-10 16:29:27 +02:00
|
|
|
$this->postcms = new CmsPsPost($id_post_cms, $this->context->language->id);
|
|
|
|
|
|
|
|
if (!Validate::isLoadedObject($this->postcms)
|
|
|
|
|| !$this->postcms->active) {
|
|
|
|
header('HTTP/1.1 404 Not Found');
|
|
|
|
header('Status: 404 Not Found');
|
|
|
|
}
|
|
|
|
parent::init();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function initContent() {
|
|
|
|
parent::initContent();
|
2015-08-12 10:53:32 +02:00
|
|
|
|
2015-08-12 14:41:06 +02:00
|
|
|
$article = CmsPsPost::injectsData($this->postcms);
|
|
|
|
|
2015-07-10 16:29:27 +02:00
|
|
|
$this->context->smarty->assign(array(
|
|
|
|
'path' => Tools::getPath($this->postcms->id, '', FALSE, 'postcms'),
|
2015-08-12 14:41:06 +02:00
|
|
|
'post' => $article
|
2015-07-10 16:29:27 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
$this->setTemplate(_PS_THEME_DIR_.'postcms.tpl');
|
|
|
|
}
|
|
|
|
|
2015-08-12 12:04:17 +02:00
|
|
|
}
|