Skip to end of metadata
Go to start of metadata

<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[

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

I'm writing this page to propose some additional feature to the Zend Framework.
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

I want to have control on all website's urls.

4. Dependencies on Other Framework Components

  • Zend_Config
  • Zend_Controller_Router
  • Zend_Filter
  • Zend_Controller_Action_Helper_Url

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.

7. Class Index

8. Use Cases

9. Class Skeletons

]]></ac:plain-text-body></ac:macro>

]]></ac:plain-text-body></ac:macro>

Labels:
proposal proposal Delete
url url Delete
seo seo Delete
router router Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 18, 2008

    <p>Have a look at <ac:link><ri:page ri:content-title="Zend_Filter_Sanitize - Martin Hujer" /></ac:link></p>

  2. Jun 20, 2008

    <p>Is this proposal still active?</p>

    <p>,Wil</p>

    1. Sep 25, 2008

      <p>doesn't seem like it. Inactive for 8 months now. --> archive?</p>

      1. Sep 25, 2008

        <p>Agreed. Archiving now.</p>