1

我必须在 smarty (prestashop) 中检查 file_exists,但我找不到获取 prestashop 基本目录的方法。

有什么办法可以用 smarty 返回 php 的 getcwd() 吗?另一个好的解决方案是,如果你能告诉我是否有 prestashop 保留变量?

{$base_dir}返回 http://... (url) 但我需要 /home/user/public_html

它是在 smarty 的保留变量中定义的吗?

4

1 回答 1

2

您可以将 PHP 常量与 smarty 一起使用:

{if file_exists($smarty.const._PS_ROOT_DIR_|cat:"/path/to/file.jpg")}
   {* code *}
{/if}
于 2013-04-10T08:17:28.517 回答