[Solar-talk] Nested controllers

Travis Swicegood development at domain51.com
Sun Oct 1 11:58:11 PDT 2006


Howdy all,

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.

Besides the obvious advantage of being able to setup an environment for 
various types of display (i.e., an RSS PageType might tell your 
Controller to only output it's list data in RSS format), it also gives 
you the ability to remove that display completely.  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.

Any thoughts on this one way or the other?
-Travis


More information about the solar-talk mailing list