我必须在smarty(prestashop)中检查file_exists,但我找不到获取prestashop基本目录的方法。
有什么方法可以用smarty返回php的getcwd()吗?另一个好的解决方案是,如果你能告诉我是否有prestashop保留变量?
{$base_dir}
返回http:// ...(url),但我需要/ home / user / public_html
它是否在smarty的保留变量中定义了什么?
答案 0 :(得分:2)
你可以使用PHP常量和smarty:
{if file_exists($smarty.const._PS_ROOT_DIR_|cat:"/path/to/file.jpg")}
{* code *}
{/if}