哪个是使用MVC模板的最佳方式

时间:2012-09-09 09:53:36

标签: php templates

让你的模板更好吗

<html>
<head>
<title><?php echo $this->data['title']; ?></title>
</head>
<body>
   <?php echo $this->data['content']; ?>
</body>
</html>

或者有类似的东西:

require('head.php');
require('header.php');
require('content.php');
require('footer.php');

1 个答案:

答案 0 :(得分:2)

这只是一个偏好问题。我个人喜欢将页眉,正文和页脚分开。在我自己的小世界里看起来更清洁。我也使用模板文件将它们一起解析,因为你提到mvc我猜你已经有了一个。