如何从php分离样式(css + html) [英] how to isolate the style (css+html) from php
问题描述
如何分离风格( css ) + html )来自 php ,就像放在php文件只是一些行包括整个 style 或主题的问题。
how can i isolate the style (css+html) from php, like put in the php file just some lines including by it the whole style or theme.
ex:
echo
eval_template("header") .
eval_template("body") .
eval_template("footer")
所以在将来我可以改变整个风格
So in future i can change the whole style without touch the php files any idea ?
推荐答案
有很多方法可以做this ...
there are many ways how you could do this...
这是一个简单的PHP模板教程
http://www.phpro.org/tutorials/Introduction-to-PHP-templating.html
Here's a tutorial on templating in plain PHP http://www.phpro.org/tutorials/Introduction-to-PHP-templating.html
你还可以看看那里的许多模板引擎。
twig是其中之一: http://twig.sensiolabs.org/
You can also take a look at the many template engines out there. twig is one of them: http://twig.sensiolabs.org/
这篇关于如何从php分离样式(css + html)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!