2011-01-13 104 views
1

嗨很新的智者,并想知道如果我可以从不同的网络服务器加载模板...我试图加载模板

$smarty->template_dir = "http://www.testsite.com/templates"; 

,但没有运气,而且不知道什么尝试接下来的任何帮助将大大appricated谢谢你!

+2

这可能是不明智的,因为你会尽一切你使用模板时到远程服务器的呼叫。你想做什么? –

+0

网站bulider – Riskeh

回答

0

为什么不做一个

if(time() - file_mtime("/tmp/template_dir/tmp_template.tpl") > 86400) 
file_put_contents("/tmp/template_dir/tmp_template.tpl", file_get_contents("http://www.testsite.com/templates/template.tpl")); 
$smarty->template_dir = "/tmp/template_dir/"; 
1

我不知道Smarty是否支持远程模板源,但即使这样做,问题在于模板文件很可能会被解析为远程服务器上的PHP - 您需要配置www.testsite.com上的Web服务器不使用PHP处理/ templates中的模板文件。