[Solar-talk] Somehow nested controllers / Support for multiple applications

Rodrigo Moraes rodrigo.moraes at gmail.com
Wed Jun 6 10:49:26 PDT 2007


On 6/6/07, Paul M Jones wrote:
> ... which maps "http://example.com/foo" to the Vendor_App_Bar page
> controller, and 'baz' to the Some_Other_Class page controller.  But
> it's not smart enough right now to map anything after the first path
> element.

How could this be done without building an entire tree inside the
front controller, with all the possibilities?

<brainstorm>
I first thought (and made a rough draft) to ask the page controller if
the requested action is mapped to another (or another controller).

Basically, instead of $obj->fetch() in the end of
Solar_Controller_Front::fetch(), I used:

    // Check if the controller routes to another action/controller
    $controller = $this->_route($obj, $uri->fetch());
    return $controller->fetch($uri);

_route() is a recursive function which looks for a matching key in the
app 'routing' config, and if found instantiates and returns the next
controller and so on. In the end, the front controller executes
fetch() on the same initial controller or another 'forwarded'
following its routing definitions.
</brainstorm>

The idea as described above has no benefits besides 'routing' to
another controller/action. It creates different app instances just to
look for their routes.

If each instance was assigned to the next one, it would be something
like the nested controllers we have talked about once.

Just a brainstorm, anyway. Do you see any useful/tremendously bad idea
here or have other thoughts to put in the table? :)

-- rodrigo


More information about the solar-talk mailing list