例如,我在这个模板中有模板home.tpl,我希望加载/common/slider.tpl模板。这可以从“模板”加载模板吗?我怎么能做到呢?
发布于 2015-09-03 10:18:26
有可能..。你必须在slider.tpl控制器上调用home.tpl控制器,
在目录/控制器/公用/ like . the中添加如下行
$data['slider'] = $this->load->controller('common/slider');catalog/view/your_theme/template/common/home.tpl添加以下行,您希望在该行中使用滑块
echo $slider;您必须删除控制器/slder.php中的以下一行,
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/slider.tpl')) {
$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/common/slider.tpl', $data));
} else {
$this->response->setOutput($this->load->view('default/template/common/slider.tpl', $data));
}再加上以下几行,
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/login.tpl')) {
return $this->load->view($this->config->get('config_template') . '/template/common/slider.tpl', $data);
} else {
return $this->load->view('default/template/common/slider.tpl', $data);
}https://stackoverflow.com/questions/32372436
复制相似问题