示例 Zend 框架项目 1.8+
首先我要说的是;我知道也存在类似的问题,但这些问题已经存在几年了,而且采埃孚正在迅速改变。我想要一个更新的例子。
人们注意到 Zend Framework 的文档缺乏。我读了很多它并用它启动了一些应用程序,但我发现很难理解如何正确地做事。我最大的问题是各种组件所属的位置、它们应该在哪里实例化等。
我试图遵循 MVC 最佳实践,使用瘦控制器、胖模型。我还尝试使用最新的 MVC 堆栈,包括 Zend_Application 和推荐的 Bootstrap 类。
我希望看到一个使用框架最佳实践的示例站点,它可以演示以下组件(理想):
- Zend_ACL/Zend_Auth:如何在应用程序中实际使用它们,如何将其适合您的模型等。
- Zend_Layout:如何使用菜单等常见部分正确执行此操作
- Zend_Navigation:我大多不知道最好的练习实例化它。
- Zend_Cache:再说一遍,它属于哪里,你在控制器中使用它吗(可能?)
- Zend_Db:我希望示例明显使用数据库,但我更喜欢仅使用 ZF 而不是 Doctrine
- Zend_Feed:我不完全确定如何正确制作 RSS 提要(即设置内容类型等)
- Zend_Form:我还没有'还没有使用过这个,但我知道它对于验证传递到模型中的数据很有用。我希望看到它的实际效果
- Zend_Paginator:同样,你在哪里实例化它,模型还是控制器?
我知道我不需要使用框架中的所有内容,但我想尝试使用任何适合我需要的内容,并且我想了解更多相关信息。
那么您知道使用 Zend MVC 和部分或全部这些组件的好示例吗?以及遵循大量最佳实践的一个?理想情况下,它至少使用 1.10,但 1.8 或更高版本就足够了。
Let me begin by saying this; I know that similar questions exist, but they are a couple years old and ZF is changing quickly. I want a more recent example.
It has been noted a lot that the documentation on Zend Framework is lacking. I've read a lot of it and used it to start up a few applications, but I find that it is really difficult to understand how to do things properly. My biggest issue is where various components belong, where they should be instantiated, etc.
I am trying to follow MVC best practices, with thin controllers, fat models. I am also trying to use the latest MVC stack including Zend_Application and the recommended Bootstrap classes.
I want to see an example site that uses best practices for the framework which can demonstrate the following components (ideally):
- Zend_ACL/Zend_Auth: how to actually use them in an application, how to fit it in to your model, etc.
- Zend_Layout: how to do this properly with common parts such as a menu
- Zend_Navigation: I mostly don't know the best practice for instantiating this.
- Zend_Cache: Again, where does it belong, do you use it in Controllers (probably?)
- Zend_Db: I want the example to use a database obviously, but I'd prefer just using ZF and not Doctrine
- Zend_Feed: I'm not completely sure how to make an RSS feed properly (i.e. set the content type, etc.)
- Zend_Form: I haven't used this yet, but I understand it is good for validating data passed into the Model. I'd like to see this in action
- Zend_Paginator: Again, where do you instantiate this, Model or Controller?
I know I do not need to use everything in the framework, but I want to try to use whatever may fit my needs and I'd like to learn more about it.
So do you know of a good example that uses the Zend MVC and some or all of these components? And one that follows a lot of best practices? Ideally, it is using at least 1.10, but anything 1.8 or later will suffice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我推荐以下资源:
要回答其他问题:
I'd recommend the following resources:
To answer the other questions:
您可以查看 ZF 中构建的 cms 系统。一种是 TomatoCMS。项目清单和使用 ZF 的应用程序位于此处。 Zend Framework 网站 也是在 ZF 中构建的。
You can check out cms systems build in ZF. One is TomatoCMS. The list of Projects & Applications using ZF is here. Zend Framework website is build in ZF too.