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: Action Controller Directory Tree Component Proposal

Proposed Component Name Action Controller Directory Tree
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Action Controller Directory Tree
Proposers Christopher Thompson
Revision 1.1 - 22 June 2006: Created. (wiki revision: 8)

Table of Contents

1. Overview

Allow Action controllers to be organized in a directory tree.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • Change allowable ":controller" parameter to allow path separators
  • Change Dispatcher and possibly other classes to support Action controller paths
  • Protect against security risks of allowing this additional capability

4. Dependencies on Other Framework Components

  • Zend_Controller_Dispatch
  • Zend_Front * possibly
  • Zend_Router * possibly
  • Zend_RewriteRouter * possibly

5. Theory of Operation

The change would allow syntax in the ":controller" parameter to allow Action controllers in sub-directories within the "controllers" directory to be referenced. I propose that the character "_" be allowed in the ":controller" parameter and that it be converted to the path separator character in the same way that Zend::loadClass() does. This will be consistent with the current formatting scheme. I do not propose that other characters be allowed in sub-directory names – only [a-zA-Z0-9] – but that option is possible.

6. Milestones / Tasks

zone: Missing {zone-data:milestones}

7. Class Index

N/A

8. Use Cases

Given the code:

The URL:

www.mydomain.com/subdir_path_example/bar/

Would dispatch the Action controller in:

/path/to/my/controllers/subdir/path/ExampleController.php

9. Class Skeletons

N/A

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

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

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jun 23, 2006

    <p>I like the idea, maybe you could look into creating a patch for RewriteRouter that adds this support? I don't see it being a whole seperate class really?</p>

    1. Jun 23, 2006

      <p>This is proposed at a change mainly to the Dispatcher, but some other changes may be necessary (based on my making this change on the 1.1 code a while back)</p>

      1. Jul 07, 2006

        <p>Like it, but I would allow either _ or - to divide directories. Some people prefer dashes in the URLs.</p>

        <p>www.mydomain.com/subdir-path-example/bar</p>

        <p>It's a pretty simple proposal, really, so I don't have anything more substantive to contribute. <ac:emoticon ac:name="smile" /></p>

  2. Aug 11, 2006

    <p>I'm more interested in a way to specify the sub directory for a route, for example a url of <a class="external-link" href="http://example.org/admin/controller/action/params">http://example.org/admin/controller/action/params</a> could be configured to look in controller_dir/admin/ControllerController.php.</p>

    <p>As for your proposal, I don't mind it being implemented, but I would like to be able to disable it too.</p>

    1. Sep 20, 2006

      <p>I am looking for this ability too Nikolai.</p>

      <p>URLs of the form:</p>

      <p><a class="external-link" href="http://example.com/members/XX/YY">http://example.com/members/XX/YY</a>
      <a class="external-link" href="http://example.com/admin/XX/YY">http://example.com/admin/XX/YY</a></p>

      <p>"look better" than</p>

      <p><a class="external-link" href="http://example.com/members_XX/YY">http://example.com/members_XX/YY</a>
      <a class="external-link" href="http://example.com/admin_XX/YY">http://example.com/admin_XX/YY</a></p>

      <p>(IMO!)</p>

      1. Sep 21, 2006

        <p>I just have to agree to Rob and Nikolai.</p>

        <p>With Slashes instead of Underscore we could also define the areas more clearly.</p>

  3. Oct 10, 2006

    <p>The only part of this proposal that I see as beneficial is the ability to have the controllers themselves within a tree. As it is, I believe this would only require:</p>

    <p>1. Creating (rewrite) router rules that map a controller to a valid class name: :controller => Some_Subdir_Class<br />
    2. Modifying the dispatcher's <em>formatName() to allow the '</em>' in names; thus, class names could indicate controllers in a tree.</p>

    <p>If this will resolve the issue, I am willing to accept this proposal.</p>

  4. Oct 11, 2006

    <ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Comment</ac:parameter><ac:rich-text-body>
    <p>We are accepting this proposal, using Matthew's second point. Matthew will do the change (one line change), and it will be incorporated into the MVC refactoring when it is released.</p></ac:rich-text-body></ac:macro>

  5. Mar 18, 2008

    <p>And whats happened?</p>

  6. Mar 18, 2009

    <p>This proposal appears abandoned. Archiving for now.</p>