We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
老实说 - 在我自己寻找这些信息的过程中,我没有找到很多资源,但是通过查看 Zend Framework 本身中的许多组件(特别是 Zend_Form),您可以获得很多灵感来寻找解决方案。 我刚刚制作了一个具有“元素”和“装饰器”层次结构的“内容”包。 元素本身可以提供它们的默认装饰器 - 并且您可以向它们附加任意装饰器(例如将所有内容框包装在
样式显示在一页上,
“查看助手”变得非常方便,允许您通过调用
< 来完成“最新博客评论”样式框。 ?php echo $this->blogComments($article) ?>
在视图中 - 调用My_View_Helper_BlogComments::BlogComments()
我绝对建议您拥有自己的Zend_Form。
子类以及碰巧是表单的可重用组件(即联系我们是“My_Form_ContactUs
”)。“部分”视图助手对于抽象显示的某些部分也很方便。到其他可重用文件。
partial('blog/_comments.phtml', null, array('article'=>$article));
- 当局部克隆 Zend_View 时,会产生更多的开销。处理 JS/CSS 包含变得稍微复杂一些,我所做的是构建一个静态类,您可以“需要”一个“库”,它将检查该库是否已被包含,如果没有 - 它调用 headScript() / headLink() 用于包含所需的文件。 (用于 FCKEditor / Sortable / jQuery / 等)。 最终看起来像:
My_Script::requireLibrary('fckeditor');
Honestly - I haven't found many resources in my own hunt for this information, but you can get a lot of inspiration to finding your solution by looking at many of the components within Zend Framework itself, particularly Zend_Form. I just made up a "Content" package that has "Element" and "Decorator" hierarchy. The elements themselves can provide their default decorators - and you can attach arbitrary decorators to them (for instance wrapping all your content boxes in
<ul class='content'><li>.....</li>.....</ul>
style display on one page."View Helpers" become very handy, allowing you to do your "latest blog comments" style boxes by calling
<?php echo $this->blogComments($article) ?>
in the view- which callsMy_View_Helper_BlogComments::BlogComments()
. I definitely suggest having your ownZend_Form
subclasses as well for reusable components that happen to be forms (i.e. contact us being a "My_Form_ContactUs
" ).The "partial" view helper comes in handy as well for abstracting certain parts of display to other reusable files.
<?php echo $this->partial('blog/_comments.phtml', null, array('article'=>$article)); ?>
- There is a little more overhead used for a partial as it clones a Zend_View.Handling the JS/CSS includes gets slightly more complicated, what I did was build a static class that you can "require" a "library" which would check to see if that library had already been included, if not - it calls headScript() / headLink() for inclusion of the required files. (used for things like FCKEditor / Sortable / jQuery / etc). Ends up looking like:
My_Script::requireLibrary('fckeditor');