Custom header to Opencart Information pages -
i trying create custom information pages in open cart, have specific header. have done using piece of code in header.php
if (!isset($this->request->get['route']) || (isset($this->request->get['route']) && ($this->request->get['route'] == 'information/information'))) { if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/header_pro.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/header_pro.tpl'; } else { $this->template = 'default/template/common/header_pro.tpl'; }} else { if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/header.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/header.tpl'; } else { $this->template = 'default/template/common/header.tpl'; }
now want chose several information pages want assign header_pro.tpl ideas how that? have been struggling while, thank in advance!
first of all, since need check whether route information/information
, has set need only
if (isset($this->request->get['route']) && ($this->request->get['route'] == 'information/information'))) {
now check concrete information pages, note down ids, , add condition
if (in_array($this->request->get['information_id'], array(1, 2, 3, 45, 49))) { // display header_pro.tpl }
so make in once looking like:
if (isset($this->request->get['route']) && $this->request->get['route'] == 'information/information' && in_array($this->request->get['information_id'], array(1, 2, 3, 45, 49))) { if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/header_pro.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/header_pro.tpl'; } else { $this->template = 'default/template/common/header_pro.tpl'; } } else { if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/header.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/header.tpl'; } else { $this->template = 'default/template/common/header.tpl'; } }
Comments
Post a Comment