NYCPHP Meetup

NYPHP.org

[nycphp-talk] cake url question

Marcin Szkudlarek marcin.szkudlarek at gmail.com
Thu Nov 2 03:40:12 EST 2006


Nate,
Interesting, but the hard coded values is what I'm trying to avoid. In
similar way I could just add methods in my controller named after each
brand. I will do that if there is no better solution.

Marcin

On 01/11/06, Nate Abele <nate at cakephp.org> wrote:
>
> 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 --------------
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20061102/ea067427/attachment.html>


More information about the talk mailing list