问题
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