| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- include_once dirname(__FILE__).'/../../classes/chcreapost.php';
- class ChcreateursingleModuleFrontController extends ModuleFrontController
- {
- public function __construct()
- {
- parent::__construct();
- $this->controller_type = 'modulefront';
- $this->page_name = $this->module->name.'-single';
- }
- public function init()
- {
- parent::init();
- $rewrite = Tools::getValue('rewrite');
- $this->id_chcreaposts = Tools::getValue('id');
- $this->chcreapost = Chcreapost::getSinglePost($this->id_chcreaposts);
- }
- public function setMedia($isNewTheme = false)
- {
- parent::setMedia();
- $this->context->controller->addJS(chcrea_js_dir.'chslider.js');
- }
- public function initContent()
- {
- parent::initContent();
- $chcreavars = [];
- $chcreavars['name'] = $this->chcreapost['meta_title'];
- $chcreavars['description'] = $this->chcreapost['meta_description'];
- $chcreavars['class'] = $this->module->name.'_post';
-
- $this->context->smarty->assign('chvars', $chcreavars);
- $this->context->smarty->assign('chpost', $this->chcreapost);
- $this->context->smarty->assign('disable_blog_com', true);
- $postNext = Chcreapost::getNextPost($this->chcreapost['position']);
- $postPrevieus = Chcreapost::getPreviousPost($this->chcreapost['position']);
- //print("next/previous:".$postNext." ".$postPrevieus);
- if (is_array($postNext) && count($postNext) > 0) {
- $this->context->smarty->assign('link_post_next', $postNext['link']);
- }
- if (is_array($postPrevieus) && count($postPrevieus) > 0) {
- $this->context->smarty->assign('link_post_previeus', $postPrevieus['link']);
- }
- $this->setTemplate('module:'.$this->module->name.'/views/templates/front/single.tpl');
- }
- public function getBreadcrumbLinks()
- {
- $breadcrumb = parent::getBreadcrumbLinks();
- $breadcrumb['links'][] = [
- 'title' => Configuration::get(strtoupper($this->module->name).'_TITLE'),
- 'url' => '/'.Configuration::get('CHCREATEUR_URL'),
- ];
- $breadcrumb['links'][] = [
- 'title' => $this->chcreapost['post_title'],
- 'url' => $this->chcreapost['link'],
- ];
- return $breadcrumb;
- }
- }
|