0
我正在使用opencart開源電子商務網站。我遇到的主要問題是,當我嘗試將麪包屑分離成每個.tpl文件中包含的單個文件時。我曾嘗試使用基本的PHP包含方法,雖然這不起作用。Opencart - 在.tpl中包含.tpl
在回覆周杰倫的回答是:
我創建了一個新的麪包屑控制器,使得獨立的麪包屑模板文件。
<?php
class ControllerCommonBreadcrumb extends Controller {
public function index() {
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/breadcrumbs.tpl')) {
$this->template = $this->config->get('config_template') . '/template/common/breadcrumbs.tpl';
} else {
$this->template = 'default/template/common/breadcrumbs.tpl';
}
$this->render();
}
}
?>
雖然這將導致錯誤:
Notice: Undefined variable: breadcrumbs
謝謝傑伊,我想我理解正確。 –