I'm creating an app in CakePHP which requires me to run 'multiple' apps within one CakePHP installation. Something like I have n controllers that behave the same for all applications, but they only differ when I call the database - anyway, I need to create a route which behaves something like this:
/app1/controller/action/a/b/c
/app2/controller/action/a/b/c
(where app1
and app2
are alphanumeric strings that can change to anything)
That would be routed to something like:
/controller/action/app1/a/b/c(or the same for app2, and so on)
The routed route could be just /controller/action/a/b/c
too, but I need to have a way to access the app1
/ app2
parts of the URL within the controller (for further processing within the controller). Is there a way to do this in CakePHP? Thanks.
Slightly related question: When the above is accomplished, is there a way to set a 'default' app-name (like when I attempt to access /controller/action/a/b/c
it will automatically be routed to the equivalent of typing /global/controller/action/a/b/c
?)
Thanks!
Effectively: What I want is just to use Routing (or any other CakePHP 'method' that can do this) to handle URLs like /foobar/controller/action/the/rest
to /controller/action/the/rest
and pass "foobar" to the controller, somehow. "Foobar" is any alphanumeric string.