Tuesday, May 8, 2012

Re: Little help with routes and links

Can you throw some background on what you are trying to achieve (why these links?)?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 8 May 2012, at 14:29:16, Mike Griffin wrote:

On Tue, May 8, 2012 at 1:26 PM, Confused Dev <confused.devel@gmail.com> wrote:
Hello.
I'd like to have links like this:
http://example.com/items/blue/bowl/1

I don't even know where to begin to make it produce automatic links
like that. Any help would be greatly appreciated.

You could try something like this, it probably won't work as written,
but it might give you a starting point.

Router::connect(
   '/items/:colour/:item/:number',
   array('controller' => 'items', 'action' => 'index', 'number' => null),
   array(
       'colour' => '\w+',
       'item' => '\w+',
       'number' => '\d+'
   )
);

Also, have a look at
http://book.cakephp.org/2.0/en/development/routing.html#passing-parameters-to-action

Mike.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: