42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
if (!class_exists('CmsPsEdito')) {
|
|
require_once _PS_MODULE_DIR_.'cmsps/classes/CmsPsEdito.php';
|
|
}
|
|
|
|
class PostEditoControllerCore extends FrontController
|
|
{
|
|
public $php_self = 'postedito';
|
|
public $postedito;
|
|
|
|
public function canonicalRedirection($canonical_url = '') {
|
|
parent::canonicalRedirection($this->context->link->getPostEditoLink($this->postedito->id));
|
|
}
|
|
|
|
public function init() {
|
|
$id_post_edito = Tools::getValue('id_post_edito', 0);
|
|
$this->postedito = new CmsPsEdito($id_post_edito, $this->context->language->id);
|
|
|
|
if (!Validate::isLoadedObject($this->postedito)
|
|
|| !$this->postedito->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;
|
|
|
|
$last_editos = CmsPsEdito::getAllEditos($id_lang, 10, 1);
|
|
|
|
$this->context->smarty->assign(array(
|
|
'last_editos' => $last_editos,
|
|
'edito' => $this->postedito
|
|
));
|
|
|
|
$this->setTemplate(_PS_THEME_DIR_.'postedito.tpl');
|
|
}
|
|
|
|
} |