2016-09-06 33 views
1

我正在使用Prestashop模块。在这个模块中我有一个冗长的html模板。所以,我将它分解成更小的子模板。无法在同一模块模板中加载相同的模块模板文件

现在,我有一个基本模板文件,其中包括我的所有子模板文件。

我的模板目录是如下:

/modules/my_module/views/templates/front/base.tpl 
/modules/my_module/views/templates/front/upper_section.tpl 
/modules/my_module/views/templates/front/middle_section.tpl 
/modules/my_module/views/templates/front/bottom_section.tpl 

现在,我包括所有base.tpl上面的模板文件,如下图所示代码:

{include file='upper_section.tpl'} 
{include file='middle_section.tpl'} 
{include file='bottom_section.tpl'} 

当我跑我的弗朗控制器的模块,然后prestashop给我错误为“无法加载模板upper_section.tpl”。

我也尝试给模板文件的相对以及绝对路径,但每次我得到相同的错误。

任何人都可以请帮我解决这个问题吗?

回答

1

更改您的包含以包含当前文件夹中的文件。

{include file='./upper_section.tpl'} 
{include file='./middle_section.tpl'} 
{include file='./bottom_section.tpl'} 
+0

谢谢。这是工作 – Dhirender

0

另一种方式给你。

{include file='module:my_module/views/upper_section.tpl'}