NYCPHP Meetup

NYPHP.org

[nycphp-talk] cake url question

Marcin Szkudlarek marcin.szkudlarek at gmail.com
Thu Nov 16 05:01:17 EST 2006


For people struggling with the same problem, I managed to do it like Jon
suggested.
I can say that Cake is a very flexible and easy to use framework.
Thanks for your help!

Marcin

On 02/11/06, Jon Baer <jonbaer at jonbaer.com> wrote:
>
> Hard to say without seeing your routes.php, can you post?
>
> - Jon
>
> On Nov 2, 2006, at 3:33 AM, Marcin Szkudlarek wrote:
>
> Jon,
>
> The problem I found with this solution is that when I create a link
> pointing to specified brand cake automatically adds name of the controller
> to the url. Say for example I create link:
> $html->link("bmw", "/bmw/");
> cake renders it as :
> <a href="/cake/controller_name/bmw">bmw</a>
> Now when I move up one level in routes.php the url is not pointing to:
>  /cake/bmw
> but
> /cake/controller_name/bmw.
> It there way to get around it?
>
> Marcin
>
> On 01/11/06, Jon Baer <jonbaer at jonbaer.com> wrote:
> >
> > You should place them in a central controller or else you will get bit
> > later ...
> >
> > Ie:
> >
> > example.com/cars/bmw
> > example.com/cars/toyota
> > example.com/cars/nissan
> >
> > In your routes.php:
> > $Route->connect('/cars/*', array('controller' => 'Car', 'action' =>
> > 'view'));
> >
> > In your car controller:
> > function view($car = '') {
> >   if ($car) {
> >      $cars = $this->Car->findAllByCar($car); // (dynamic) available in
> > 1.2
> >   } else {
> >      $cars = $this->Car->findAll();
> >   }
> >   $this->set('cars',$cars);
> >   $this->render('view');
> > }
> >
> > If you *need* to have those URLs instead you can just move the Route up
> > one level.
> >
> > - Jon
> >
> > On Nov 1, 2006, at 6:27 AM, Marcin Szkudlarek wrote:
> >
> > 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
> > _______________________________________________
> > 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
> >
> >
> >
> > _______________________________________________
> > 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
> >
> >
> >
> _______________________________________________
> 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
>
>
>
> _______________________________________________
> 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/20061116/424d9cfb/attachment.html>


More information about the talk mailing list