[Solar-talk] Nested controllers

Travis Swicegood development at domain51.com
Thu Oct 19 07:11:57 PDT 2006


Hi Rodrigo,

Rodrigo Moraes wrote:
> On 10/1/06, Travis Swicegood wrote:
>   
>> I'm curious to get some feedback on nested controllers.  I've used them
>> in another framework where your URL might be something like this:
>>
>> index.php/PageType/Controller/Action
>>
>> PageType was just another controller that allowed you to put whatever
>> your display level elements above the controller.  Some of the PageTypes
>> would be HTML, PDF, RSS, Mobile, etc., etc.  Generally these acted like
>> a sort of front controller.  You had access to them in the URL, however,
>> they were different in that they weren't required.  There was an
>> abstract level front controller (we called it a dispatcher) that
>> index.php started the process with.  Ideally in my mind, you could chain
>> controllers together indefinitely, though I don't know how practical it
>> would be.  Pragmatically, you just need the three levels with the first
>> and the last being optional.
>>     
>
> Ok, back to this subject. :)
>
> Does this idea evolved? It seems that putting PageType in the first
> level is unnecessary. With nested (or "forwarding") controllers, the
> last controller in the chain shouldn't be allowed to tell which
> display should be rendered? How about this:
>
>     index.php/Controller/Action/PageType
>   

Actually, no you wouldn't want it to execute that way.  Let me put the 
URI in a more understandable format:

    index.php/PageType/Controller/Action
is
    index.php/HTML/Bookmarks/List

So, the idea is that Bookmarks/List here generates a the actual content 
while HTML, acting as the parent controller, wraps the content.  The 
same could be done with:

    index.php/RSS/Bookmarks/List
    index.php/PDF/Bookmarks/List
    index.php/Bookmarks/List

The last example without a pagetype would render just the raw 
Bookmarks/List.

-Travis



More information about the solar-talk mailing list