Path Problem with Custom Prestashop module

你离开我真会死。 提交于 2020-01-25 10:35:12

问题


Can someone help me with a file path problem I am experiencing with a custom Prestashop module 1.6 version?

The following works perfectly in a localhost environment:

return $this->display(__FILE__, '../../product-list.tpl');

however does not work on a live server. The following does work:

return $this->display(__FILE__, '../../themes/default-bootstrap/product-list.tpl');

which is not acceptable as some customers will not be using the default-bootstrap theme.

Any assistance with this problem will be appreciated.

Thanks


回答1:


"$this->display" command has many dependencies on ModuleCore SO it's better to use include on custom tpl file:

return $this->display(__FILE__, 'views/templates/custom.tpl');

then on your custom.tpl :

{include file="$tpl_dir./product-list.tpl" products=$products}


来源:https://stackoverflow.com/questions/53575368/path-problem-with-custom-prestashop-module

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!