<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[
I'm writing this page to propose some additional feature to the Zend Framework. I want to have control on all website's urls.
Zend Framework: Additional features Component Proposal
Proposed Component Name
Additional features
Developer Notes
http://framework.zend.com/wiki/display/ZFDEV/Additional features
Proposers
My E-mail Address
Revision
1.1 - 1 August 2006: Updated from community comments. (wiki revision: 13)
Table of Contents
1. Overview
Maybe it will be useful to manage all URLs in the website and transform them in SEO friendly urls, or simply to have a powerful sistem that doesn't permit non existent urls... Or also, the possibility of automatically filter urls with Zend_Filter.2. References
3. Component Requirements, Constraints, and Acceptance Criteria
So, if I assemble the url with $NICKNAME = 'Prova', the resulting url must be htt://test.it/prova/ and NOT http://test.it/Prova/
EX: http://test.it/Prova/ (with filter strtolower on parameter NICKNAME) must automatically redirect to http://test.it/prova/
EX:http://test.it/url.php? --> must be http://test.it/url.php without question mark like end character of the url string.
EX:http://test.it/prova.php?par1=uno&par1=due --> par1 is declared 2 times!!! must return http://test.it/prova.php?par1=due4. Dependencies on Other Framework Components
5. Theory of Operation
I'm not writing about a single component. I think the best choice to manage urls is to use:
- Zend_Config & Zend_Filter together in xml or ini files (so you can have custom configuration foreach rewrite rule)
- Zend_Controller_Router must check the assembled url is equal to the request uri. If not, perform a redirect to the correct url
- Zend_Filter_SeoUrl (as proposed byMartin Hujerhere: http://framework.zend.com/wiki/display/ZFDEV/Zend_Filter_SeoUrl) must give the possibility Zend_Controller_Action_Helper_Url->url() return always semantically correct urls.
6. Milestones / Tasks
I write some code of example here:
1) http://test.it/NICKNAME/ --> NICKNAME in lower case letters:
CONFIG file for routing:
routes.homeuser.type = "Zend_Controller_Router_Route_Regex"
routes.homeuser.route = "([a-z0-9]+)/*"
routes.homeuser.defaults.module = "user"
routes.homeuser.defaults.controller = "index"
routes.homeuser.defaults.action = "index"
routes.homeuser.map.1 = "nick"
routes.homeuser.reverse = "%s/"
routes.homeuser.filter.nick = "Zend_Filter_StringToLower"
; or also routes.homeuser.filter.ALLURL = "Zend_Filter_StringToLower" if I want to filter the complete url
When I call Zend_Controller_Action_Helper_Url->url(array('nick' => 'Prova'), 'homeuser'), the function must recognize there is a filter on "nick" and apply it to give me back the correct url: http://test.it/prova/ AND NOT http://test.it/Prova/
2) Check the request uri is right:
After enter the routeShutdown, I have the possibility to check if the request uri is equal to the url I can assemble with same parameters...
EX: request uri = http://test.it/Prova/
routeName = homeuser
nick = Prova
I try to assemble the url with Zend_Controller_Action_Helper_Url->url(array('nick' => 'Prova'), 'homeuser').
The result is http://test.it/prova/ (different from http://test.it/Prova/ !!! So I must do a 301 redirect to http://test.it/prova/)
This can be done with a Plugin that use the routeShutdown() Action, or after the router evaluates the request.
4 Comments
comments.show.hideFeb 18, 2008
Martin Hujer
<p>Have a look at <ac:link><ri:page ri:content-title="Zend_Filter_Sanitize - Martin Hujer" /></ac:link></p>
Jun 20, 2008
Wil Sinclair
<p>Is this proposal still active?</p>
<p>,Wil</p>
Sep 25, 2008
Tobias Gies
<p>doesn't seem like it. Inactive for 8 months now. --> archive?</p>
Sep 25, 2008
Wil Sinclair
<p>Agreed. Archiving now.</p>