开发者

Loading templates from different server

开发者 https://www.devze.com 2023-02-04 05:47 出处:网络
Hey guys quite new to smarty and was wondering if i could load templates from a different web server ... i have tried

Hey guys quite new to smarty and was wondering if i could load templates from a different web server ... i have tried

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

but with no luck and have 开发者_JS百科no idea what to try next any help would be greatly appricated thank you!


I don't know if Smarty supports remote sources for templates, but even if it does, the problem here is that the template files will most likely be parsed as PHP on the remote server - you'd need to configure the web server on www.testsite.com to not process the template files in /templates using PHP.


Why not do a

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/";
0

精彩评论

暂无评论...
验证码 换一张
取 消