Zend Framework: Zend_Controller_Plugin Component Proposal
| Proposed Component Name | Zend_Controller_Plugin |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Controller_Plugin |
| Proposers | Aleksey V. Zapparov |
| Revision | 1.1 - 14 January 2008: Initial release of proposal 1.2 - 21 May 2008: Ready for review (wiki revision: 9) |
Table of Contents
- 1. Overview
- 2. References
- 3. Component Requirements, Constraints, and Acceptance Criteria
- 4. Dependencies on Other Framework Components
- 5. Theory of Operation
- 6. Milestones / Tasks
- 7. Class Index
- 8. Use Cases
- File: project/html/index.php
- File: project/application/controllers/IndexController.php
- File: project/application/templates/default.phtml
- File: project/application/templates/printer.phtml
- File: project/html/index.php
- File: project/application/controllers/IndexController.php
- File: project/application/controllers/AdminController.php
- 9. Class Skeletons
1. Overview
This plugin will help to use web templates.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
4. Dependencies on Other Framework Components
- Zend_Controller_Plugin_Abstract
5. Theory of Operation
This plugin can use simple or complex template name format.
- Simple format is used when you don't need different representations within single template.
- Complex format used when you want to make, for example, different templates with one design. For example it can be used to create different templates for admin panel and other part of web site but in one common design.
The use of Plugin very simple. All you have to do is - set path where your templates are stored (when initaiting new instance of object), then set template name's format and set default template name.
If you want to use Smarty with this plugin, all you have to do is extend Zend_View and setView($zend_view_smarty) where $zend_view_smarty is initiated object of Zend_View_Smarty, for more details on extending Zend_View see Zend Framework manual.
This plugin assigns all segments of $_body form Zend_Controller_Response to view's variables using their names. So if you'll appendBody() in your controller, it will be assigned to $this->default in view script.
6. Milestones / Tasks
! - TODO, ? - Idea
- !: Add availability to fall back to default template if specified template wasn't found.
- ?: [DONE] Rename plugin to Zend_Controller_Plugin_Template
7. Class Index
- Zend_Controller_Plugin_Template
8. Use Cases
| UC-01 (Simple) |
|---|
| UC-02 (Complex) |
|---|
9. Class Skeletons
Aleksey,
Can you talk a bit about how this proposal differs in scope from the existing Zend_Layout component?
-Ralph
Ooops.
Seems like I've invented a bycicle. But there were no Zend_Layout component when I was in stage of inventing
)
Well, right now I've read a little about Zend_Layout and I guess in this case this proposal not needed.
ZF Home Page
Code Browser
Wiki Dashboard
Aleksey, do you plan to present this to the community for review? Does it require more work before you do so?
,Wil