Zend_Layout 和/或 Smarty
我是 Zend Framework 的新手,但计划使用它创建一个相当复杂的项目。
我正在查看 Zend Framework 的视图选项。有一个带有 Zend_View 和 Zend_Layout 的工具,并且还可以与 Smarty 等模板引擎集成。
现在我想知道,它们的目的相同吗?就像我可以使用 Zend_Layout 或 Smarty 还是两者都使用更好?
I am new to Zend Framework, but planning to create quite a complex project using it.
I was looking at the view options for Zend Framework. There is one with Zend_View and Zend_Layout and also template engines like Smarty can be integrated with it.
Now I would like to know, do they serve the same purpose? Like I can either use Zend_Layout or Smarty or is it better to use both?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我参与过两个大型 Zend 项目。我们不使用单独的布局引擎,我们只是使用内置的 Zend_View。
在 Zend 之上分层 Smarty 没有多大作用(在我看来,不过希望看到一些替代体验)
I've worked on two large scale Zend projects. We don't use a separate layout engine, we just use the built in Zend_View.
Layering Smarty on top of Zend wouldn't serve much purpose (imo, would like to see some alternative experiences though)
近 10 年来,我已经看到使用 smarty 的许多好处。首先,smarty 限制模板设计者使用仅与视图相关的一小组功能。这将使管理模板文件变得更容易,并创建一个安全层。在视图层上使用 PHP 可以使用 PHP 快速解决问题,但可能会造成很大的混乱。 Smarty 已编译,几乎没有性能损失。语法比 PHP 视图更简洁。使用 Smarty 3 的“模板继承”功能节省了大量时间,而这是用 PHP 类无法轻松实现的。
I have seen lots of benefits of using smarty for nearly 10 years. First of all, smarty restricts template designers to use small set of functions which are related to view only. This will make easier to manage template files and will create a layer of security. Using PHP on view layer allows quick solutions with PHP and can create great mess. Smarty is compiled and there is nearly no performance loss. Syntax is more concise than PHP views. With Smarty 3 "template inheritance" features saved lots of time, which cannot be easily implemented with PHP classes.