[Solar-talk] Nested controllers
Paul M Jones
pmjones at ciaweb.net
Thu Oct 19 07:29:39 PDT 2006
On Oct 19, 2006, at 9:11 AM, Travis Swicegood wrote:
> 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.
I agree with Rodrigo's earlier comment that having the page-type
first seems ... inelegant.
Besides page-types (html/rss/pdf/etc) and site layouts, what would
this be used for? I can think of other ways to respond to page-type
requests that are more transparent, and for layouts we can put all
the in the layout scripts.
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list