NYCPHP Meetup

NYPHP.org

[nycphp-talk] cake url question

Nate Abele nate at cakephp.org
Wed Nov 1 11:21:28 EST 2006


Hi Marcin,

Cake 1.2 adds support for this.  In app/config/routes.php, you can  
add a route like the following:

Router::connect('/:car_brand', array('controller' => 'cars', 'action'  
=> 'view'), array('car_brand' => 'bmw|toyota|nissan'));

The only issue is that all the possible values of car_brand must be  
hard-coded into the route.

-Nate

> Date: Wed, 1 Nov 2006 11:27:21 +0000
> From: "Marcin Szkudlarek" <marcin.szkudlarek at gmail.com>
> Subject: [nycphp-talk] cake url question
> To: talk at lists.nyphp.org
> Message-ID:
> 	<d2969d250611010327g34a88fe8n9112054120e45a5d at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I would like to map multiple url to one controller method like this:
>
> example.com/bmw
> example.com/toyota
> example.com/nissan
> ..
> should invoke method (for example "view") in my controller with  
> parameter
> "bmw", "toyota" etc.
> Probably I should configure it in routes.php but I don't have idea  
> how.
>
> Regards,
>
> Marcin
> -------------- next part --------------




More information about the talk mailing list