2013-06-12 69 views
0

我也一直在做同樣的與以前版本的Smarty ...喜歡加載指定的模板文件夾以外的TPL文件,如:Smarty的3來自外部的模板文件夾模板

$smarty->display("../admin/bin/tpl/default.tpl"); 
exit(); 

然而,由於升級後,我收到以下錯誤:

[12-Jun-2013 11:40:12 UTC] PHP Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file '../admin/bin/header.tpl' in '../admin/bin/tpl/default.tpl'' in 

回答

1

你試過絕對路徑嗎?即

$smarty->display("/var/www/mywebsite.com/templates/admin/bin/tpl/default.tpl"); 

這應該根據the manual工作(它確實對我來說)

+0

謝謝!它的工作原理...我怎麼可能先沒有猜到它?需要休息lol – Whocares

+0

不客氣;) – strikernl

+0

你也可以爲模板定義多個路徑http://www.smarty.net/docs/en/api.add.template.dir.tpl – YomY