Issue
I have URL like article_title_page-c-31-c-2.html
where I want to map to the articles controller and action category, where
article_title_page can be any value, the number 31 and 2 will be pass as parameter to the action category, and
-c- and -c- is fixed and is used to show that is should be sent to the article controller and action category, how can I do such a route in cakephp3.5?
I try the below in the route file, but problem, it can't differentiate the -c- or article_title_page-d-31-d-2.html will also go to the same controller and action, which I want to filter out
Router::connect('/:slugc-:id:c-:page.html',
['controller'=>'products', 'action'=>'category'],
['pass' => array('id','page','slug'), 'id'=>'[\d]+','page'=>'[\d]+'
]
);
Thank you for any suggestion.
Solution
I haven't tested this locally, but try this:
/:slug:c1:id:c2:page.html
And match c1 and c2 via regex to be c-.
Answered By - floriank
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.