自定义 Prestashop 模块的路径问题 [英] Path Problem with Custom Prestashop module

查看:57
本文介绍了自定义 Prestashop 模块的路径问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我解决我在使用自定义 Prestashop 模块 1.6 版本时遇到的文件路径问题吗?

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');

这是不可接受的,因为有些客户不会使用 default-bootstrap 主题.

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

对这个问题的任何帮助将不胜感激.

Any assistance with this problem will be appreciated.

谢谢

推荐答案

"$this->display" 命令对 ModuleCore 有很多依赖 SO 最好在自定义 tpl 文件中使用包含:

"$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');

然后在您的 custom.tpl 上:

then on your custom.tpl :

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

这篇关于自定义 Prestashop 模块的路径问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆