> So, I'd like to have the following URLs
> /units - for a view showing a table of multiple units
> /units/<unit name> - for a view of the single unit (no, I don't
> want to use the action in the URL like /units/view/<unit name>, I'd
> like to keep this one as short and simple as possible)
I wanted to do something similar, but rather than using routes I put a
condition in the beforeFilter of a controller. The controller is
called galleries, I wanted to keep the actions like index, view,
detail, etc. So I could have /galleries/view/<gallery id> but also to
have /galleries/<region name>
Anyway I've got the following in my controller
var $regions = array('london', 'south_west', 'north', 'south_east',
'central', 'wales', 'scotland', 'northern_ireland');
function beforeFilter()
{
if(in_array($this->action, $this->regions))
{
$this->region();
exit;
}
}
So if the is a URL like /galleries/london it will route to the the
action region() in the controller.
It works well, but I was wondering if there are better solutions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---