Thanks to ADmad from the IRC channel for this solution:

v1.1: $Route->connect('/sub1/:controller/:action/*', array());
v1.2: Router::connect('/sub1/:controller/:action/*', array());

There are just 2 downsides to this which I am still trying to resolve:

1. How can I dynamically add in these routes so an admin can (via the
web interface) add a new sub-directory and the routing will
automatically behave properly? I tried /*/:controller/:action/* but
had no luck.

2. How can I preserve my existing custom routes without re-creating
them for each sub-directory? For instance, I have $Route->connect('/
news', array('controller' => 'articles', 'action' => 'index')). But as
I (dynamically) add new sub-directories, I want each sub-directory to
utilize this route, too. In other words, adding a new sub-dir should
allow for /sub3/news without having to manually add it.



On Jan 7, 12:17 pm, etipaced <[email protected]> wrote:
> I have an application (built in 1.1, though may get upgraded to 1.2 if
> it helps my situation) that needs an additional prefix route added to
> it. For example, see the 1.2 manual entry 
> here:http://book.cakephp.org/view/544/Prefix-Routing
>
> My application already has admin routing, but I now need to move all
> the public (or non-admin routed) pages to a sub-directory (call it
> "sub1"), and add an additional sub-directory as well (call it "sub2").
>
> My dilemma is that I need sub1 and sub2 to use the exact same
> controller functions instead of having their own. Normally when using
> prefixing, you write a function to correspond with the specific prefix
> in use. For example,www.website.com/admin/users/edit/3would actually
> call UsersController::admin_edit(). Likewise in the manual entry I
> linked to above and for my hypothetical example the 
> URLwww.website.com/sub1/locations/view/3would call
> LocationsController::sub1_view(). This is a problem for me because I
> really want that URL to call LocationsController::view() instead. I
> also needwww.website.com/sub2/locations/view/3to call
> LocationsController::view() as well.
>
> I plan to set session data in AppController to distinguish which sub-
> directory (sub1 or sub2) the current user is in. That value will then
> affect my model queries.
>
> The further issue is that additional sub-directories (which are
> essentially instance copies of the application) will need to be
> dynamically added via the admin interface as well. This is why I want
> to handle the situation with a mod_rewrite customization or with
> Cake's routing.
>
> Any help or assistance is greatly appreciated! I'm also on IRC as
> etipaced. Thank you for reading :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to