Zend Framework: Zend_Controller_Dispatcher Component Proposal
| Proposed Component Name | Zend_Controller_Dispatcher |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Controller_Dispatcher |
| Proposers | zf@keppens.net |
| Revision | (wiki revision: 9) |
Table of Contents
1. Overview
In smal projects the current directory structure for controllers is sufficient. For bigger projects however, it might be useful to use subdirectories to group together certain functonalities for clarity reasons.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
- KISS
4. Dependencies on Other Framework Components
5. Theory of Operation
Currently the controller in the url can't have underscores (they are filtered out). This change would keep underscores in place and replace spaces into underscores. The Zend::loadClass has to be adjusted as well so it can use subdirectories when the dirs parameter is not null.
6. Milestones / Tasks
7. Class Index
- Zend
- Zend_Controller_Dispatcher
8. Use Cases
Suppose one of the parts of your website is a Forum, then you could have following urls:
forum_topic/list
forum_topic/add
forum_topic/edit
forum_topic/delete
forum_post/list
forum_post/rate
forum_post/view
forum_post/add
forum_post/edit
forum_post/delete
etc...
This would yield in following files
/application/controllers/Forum/TopicController.php => Class Forum_TopicController
/application/controllers/Forum/PostController.php => Class Forum_PostController
9. Class Skeletons
Zend.php : lijn 84, change:
to:
Zend/Controller/Dispatcher.php: lijn 167, added:
Zend/Controller/Dispatcher.php: lijn 91, change
to:
This is substantively the same as http://framework.zend.com/wiki/display/ZFPROP/Action+Controller+Directory+Tree+-+Christopher+Thompson, and my comments there apply here as well: a combination of a rewrite rule and a minor modification to Zend_Controller_Dispatcher::_formatName() will solve the issue.
| Zend Comment Duplicate of http://framework.zend.com/wiki/display/ZFPROP/Action+Controller+Directory+Tree |
ZF Home Page
Code Browser
Wiki Dashboard
How does this differ from http://framework.zend.com/wiki/x/CwM ?