我想知道是否有一个'最好'的方式来使一个网站与多个页面的所有页面具有相同的布局,但具有不同的内容(如脸谱,stackoverflow和许多其他网站)?来自模板的页面生成器
我目前这样做的方式是这样的:
(在我的案件的内容是一个数据库表名,然后通过SQL查询到的内容。)
的template.php:
<?php
function tplate($tablename){
echo "<html>content from $tablename</html>";
}
?>
subcat.php:
<?php
include 'template.php';
tplate('contenttable');
?>
这工作在非常简单的案件,但一旦我尝试添加更多的功能,它变得非常复杂,我花了很多时间调试。
有谁知道这是如何通常完成/最好处理?
你应该看看模板系统像[聪明] (http://www.smarty.net/)例如 – Nano