Re: Routes with variables

2006-08-07 Thread Jonathan Snook

I've got something similar in the app I build. You'd need to set up all
items off of /shop/ to go through a single action. Then, take that
action, and have it route to internal functions.

like:
function processAction($param1, $param2=null)
{
  if($param2){
$this->_products($param1, $param2);
  }else {
$this->_intro($param1);
  };
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Routes with variables

2006-08-06 Thread [EMAIL PROTECTED]

I'm a Cake newbie and have a question about routes (yes, I even
searched the past posts and didn't find my answer).

I have these two routes:
$Route->connect('/shop/:catname1', array('controller'=>'Shop',
'action'=>'intro', ':catname1'));
$Route->connect('/shop/:catname1/:catname2',
array('controller'=>'Shop', 'action'=>'products', 'catname1',
'catname2'));

Basically, I want a URL like this: /shop/women to map to the shop
controller, intro('women')

and I want a URL like this: /shop/men/shoes to map to the shop
controller, products('men','shoes')

I need catname1 and catname2 to be able to be anything.

The routes above aren't working as they're trying to map to the
controller named whatever the value of catname1 is.

Anyone know what I need to change?

Thanks,
Greg


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---