我正在使用Opencart版本2.0.3.1。如何在Opencart中创建新页面
我必须在Opencart中创建新页面。但我不知道如何开始。所以我按照给定的链接http://forum.opencart.com/viewtopic.php?t=6253来创建自定义页面。
但我得到了错误
Fatal error: Cannot access private property Document::$title in C:\wamp\www\opencart\catalog\controller\custom\service.php on line 6
为链接提到的,我创建了三个文件是:
目录/控制器/自定义/ service.php
class ControllerCustomService extends Controller {
public function index() {
$this->language->load('custom/service');
$this->document->title = $this->language->get('heading_title');
$this->document->breadcrumbs = array();
$this->document->breadcrumbs[] = array(
'href' => $this->url->http('common/home'),
'text' => $this->language->get('text_home'),
'separator' => FALSE
);
$url = '';
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->document->breadcrumbs[] = array(
'href' => $this->url->http('custom/service' . $url),
'text' => $this->language->get('heading_title'),
'separator' => $this->language->get('text_separator')
);
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['heading_text'] = $this->language->get('heading_text');
$this->id = 'content';
$this->template = $this->config->get('config_template') . 'custom/service.tpl';
$this->layout = 'common/layout';
$this->render();
}
}
目录/视图/主题/默认/模板/自定义/ service.tpl
<div class="top">
<h1><?php echo $heading_title; ?></h1>
</div>
<div class="middle">
<div><?php echo $heading_text; ?></div>
</div>
<div class="bottom"> </div>
目录/语言/自定义/ service.php
// Heading
$_['heading_title'] = 'Our Services';
//Content
$_['heading_text'] = 'Welcome to our services';
我也试图在链接中提到的解决方法,但没有运气。
所以有人请帮我解决这些问题...任何帮助真的是可观..
你可以提出任何联系,在哪里可以找到相同.. – next2u
我改变了控制器中的文件(有很多改变),现在它正在工作,但未能加载标题,页脚边栏,面包屑等 – next2u
好的..我有链接https://forum.opencart.com/viewtopic.php?f=23&t=136937 – next2u