Assuming the territory will always be a 2-letter, lowercase code ...

Router::connect(
        '/:territory/news',
        array(
                'controller' => 'news',
                'action' => 'index'
        ),
        array(
                'territory' => '[a-z]{2}',
                'pass' => array('territory')
        )
);

You could do the same for each of the actions that require territory
to be passed:

Router::connect(
        '/:territory/news/:id',
        array(
                'controller' => 'news',
                'action' => 'view'
        ),
        array(
                'territory' => '[a-z]{2}',
                'id' => '[0-9]+',
                'pass' => array('territory', 'id')
        )
);

Router::connect(
        '/:territory/news/:title',
        array(
                'controller' => 'news',
                'action' => 'view'
        ),
        array(
                'territory' => '[a-z]{2}',
                'title' => '[-_a-z]+',       // title slug
                'pass' => array('territory', 'title')
        )
);

Or you may be able to use '/:territory/news/*'. I'm not sure.

On Mon, Jun 15, 2009 at 9:49 PM, Jim Wiberley<[email protected]> wrote:
>
> Hi All,
>
> I'm looking for a way to set my site up so that the first part of the
> url is always the territory,
>
> eg. http://www.site.com/uk/news, http://www.site.com/fr/news
>
> How would I set up the routing for this so that the territory variable
> is passed on to the controller?
>
> Thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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