开发者

CakePHP routing - search parms

开发者 https://www.devze.com 2023-04-12 01:15 出处:网络
I need to set up routing based on search parms (I\'m using CakeDC search plugin) URL should look like this: /apartments/studio-apartments

I need to set up routing based on search parms (I'm using CakeDC search plugin)

URL should look like this: /apartments/studio-apartments

instead of this: /apartments/propertytype_id:1

I've already tried adding routes like this one:

Router::connect('/apartments/studio-apartments', array('controller'=>'apartments', 'action'=>'index'), array('pass'=>array('propertytype_id:1')));

or

Router::connect('/apartments/studio-apartments', array('controller' => 'apartments', 'action' => 'index', 'propertytype_id:1')); 
开发者_JS百科

or that one from Cake book


Try this in your routes.php:

Router::connect('/apartments/studio-apartments',
    array('controller' => 'apartments','action' => 'index'),
    array('propertytype_id' => '[0-9\-]+')
);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号