[Solar-talk] Nested controllers

Rodrigo Moraes rodrigo.moraes at gmail.com
Thu Oct 19 00:22:30 PDT 2006


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

> This is very useful
> in AJAX contexts, where you might want to submit a form and retrieve an
> updated list after it's completed to redisplay.  In this case, you don't
> want all of the HTML elements around the list to be displayed so instead
> of the URI being HTML/Controller/List, it would just be Controller/List.

Wouldn't it be possible to call
/index.php/SubController/SubControllerAction/ in the AJAX call, to
render only a page part? The main controller in /Controller/List would
be a wrapper for the output of subcontrollers, and some of them could
be called individually. Does this make any sense?

rodrigo

---------------------------------------------------------------------
Solar has now a Community Wiki: solarphp.org
---------------------------------------------------------------------
Join the #solarphp IRC channel on freenode.org
---------------------------------------------------------------------


More information about the solar-talk mailing list