php - Opencart: CSS (based on route maintenance) -
this first question here. i'm using opencart webshop. looks i'm styling css of pages e.g. account_login.css. want maintenance page. made common_maintenance.css file. when i'm testing site isn't displaying correct. showing http://www.mywebsite.com instead of http://www.mywebsite.com/index.php?route=common/maintenance. please can me this?
<?php class controllercommonmaintenance extends controller { public function index() { if ($this->config->get('config_maintenance')) { $route = ''; if (isset($this->request->get['route'])) { $part = explode('/', $this->request->get['route']); if (isset($part[0])) { $route .= $part[0]; } } // show site if logged in admin $this->load->library('user'); $this->user = new user($this->registry); if (($route != 'payment') && !$this->user->islogged()) { return $this->forward('common/maintenance/info'); } } } public function info() { $this->load->language('common/maintenance'); $this->document->settitle($this->language->get('heading_title')); $this->data['heading_title'] = $this->language->get('heading_title'); $this->document->breadcrumbs = array(); $this->document->breadcrumbs[] = array( 'text' => $this->language->get('text_maintenance'), 'href' => $this->url->link('common/maintenance'), 'separator' => false ); $this->data['message'] = $this->language->get('text_message'); if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/maintenance.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/maintenance.tpl'; } else { $this->template = 'default/template/common/maintenance.tpl'; } $this->children = array( 'common/footer', 'common/header' ); $this->response->setoutput($this->render()); } } ?>
i've fixed hideous formatting, , added call ->addstyle($css). if code not work yet, please check if got path css right (where says $css = 'blahblah' );
<?php class controllercommonmaintenance extends controller { public function index() { if ($this->config->get('config_maintenance')) { $route = ''; if (isset($this->request->get['route'])) { $part = explode('/', $this->request->get['route']); if (isset($part[0])) { $route .= $part[0]; } } // show site if logged in admin // $this->load->library('user'); $this->user = new user($this->registry); if (($route != 'payment') && !$this->user->islogged()) { return $this->forward('common/maintenance/info'); } } } public function info() { $this->load->language('common/maintenance'); $this->document->settitle($this->language->get('heading_title')); $css = 'catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/common_maintenance.css'; $this->document->addstyle($css); $this->data['heading_title'] = $this->language->get('heading_title'); $this->document->breadcrumbs = array(); $this->document->breadcrumbs[] = array( 'text' => $this->language->get('text_maintenance'), 'href' => $this->url->link('common/maintenance'), 'separator' => false ); $this->data['message'] = $this->language->get('text_message'); $maintenance = $this->config->get('config_template') . '/template/common/maintenance.tpl'; if (file_exists(dir_template . $maintenance ) ) { $this->template = $maintenance; } else { $this->template = 'default/template/common/maintenance.tpl'; } $this->children = array( 'common/footer', 'common/header' ); $this->response->setoutput($this->render()); } } }
Comments
Post a Comment