我需要帮助了解 Zend Framework (MVC) 页眉和页脚最佳实践
我是 MVC 和 Zend Framework 的新手,我正在开发一个项目,主要是前端项目。我试图了解什么是最佳实践。
目前,页脚和页眉是通过几个脚本设置的,其中一个是网站上所有内容的巨大 XML 文件(我认为为了使网站国际化,内容都包含在 i18n 标签中),一个存储所有链接进入一个数组,一个循环遍历所有页脚/页眉链接的数组,以及一些其他文件,我不完全确定它们的作用,但它们最终都会吐出一个简单的页脚或页眉链接的 ul。
这一切对我来说似乎很复杂,为什么页眉和页脚不只是布局中的简单 html 链接,或者是主 layout.phtml 的一部分,或者作为包含的 footer.phtml?
简单的提交按钮也用作长视图/帮助程序脚本,当我认为没有理由它们不能只是简单的 HTML 时。
我知道业务逻辑留给模型,视图应该是用于布局的更轻的前端脚本。但特别是对于 Zend 框架和 Web 开发,任何有关什么到底属于简单 HTML 以及什么应该更复杂作为辅助 php 脚本/模型脚本的指导将不胜感激。
至少能够理解页脚和页眉的最佳实践将帮助我开始。
抱歉有点长,再次感谢。
I'm new to MVC and Zend Framework and I'm working on a project, mostly on the front end. I'm trying to get a sense of what are best practices.
Currently the footer and header are setup through several scripts, one that is a giant XML file of all the content on the website (I think to make the website international friendly, things are wrapped in i18n tags), one that stores all of the links into an array, one that loops through all of the footer/header links, and some other files that I'm not totally sure what they do but they all eventually spit out a simple ul of footer or header links.
It all seems so convoluted to me, why isn't the header and footer just simple html links in layouts, either a part of the main layout.phtml or as an included footer.phtml?
Simple submit buttons are also used as a long views/ helper script, when I see no reason they couldn't just be simple HTML.
I know business logic is left for models, and views are supposed to be lighter front-end scripts for layout. But specifically for Zend framework and web development, any guidance on what exactly belongs as simple HTML and what should be more complex as a helper php script/model script would be much appreciated.
At least just being able to understand what's best practices for a footer and header would help me get started.
Sorry about the length, thanks again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设整个事情是一个布局视图脚本,以下是我的看法:
IMO,这个问题可能更适合那些对当前内容进行编码的人...ZF 非常开放,它不会强迫您使用任何特定的组织方法。我会快速阅读一下视图助手文档,因为它可能有助于阐明所使用的某些视图助手以及您可能想要使用的其他视图助手。
http://framework.zend.com/manual/en/zend.view .helpers.html
Assuming the whole thing is a layout view script, here are my opnions:
IMO, this question may be better suited towards the guys that coded what's currently there... ZF is very open ended, and it does not force you to use any specific organization methods. I'd give the view helpers documentation a quick read-over as it may help shed some light upon certain view helpers that are used, as well as others you may want to use.
http://framework.zend.com/manual/en/zend.view.helpers.html