2013-06-12 70 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