Amendment!
If you really have a slug in the second URL, then please amend the routing to:
Router::connect('/article/slug-post/:slug', ... rest of your definition...);
Enjoy, John
On Wednesday, 7 January 2015 21:13:12 UTC+2, John Andersen wrote:
-- If you really have a slug in the second URL, then please amend the routing to:
Router::connect('/article/slug-post/:slug', ... rest of your definition...);
Enjoy, John
On Wednesday, 7 January 2015 21:13:12 UTC+2, John Andersen wrote:
Both your route configurations points to that the URL "/article" follows by a parameter, so in your case only the first is used.
Change them as follows:
Router::connect('/article/show_by_day', ...rest of your definition ...);
Router::connect('/article/slug-post', ...rest of your definition...);
Kindly inform us whether or not that solved your problem :)
Enjoy, John
On Wednesday, 7 January 2015 03:34:43 UTC+2, Lợi Nguyễn Đình wrote:I am facing some problems in routing under cakephpthere are two actions in my controllerthey are as below:I want them as:So i routes file under config file I wrote as:Router::connect('/article/:show_by_day', array('controller' => 'posts', 'action' => 'show'), array('pass' => array('show_by_day'))); Router::connect('/article/:slug', array('controller' => 'posts', 'action' => 'view'), array('pass' => array('slug'))); its working fine when I hit the url example.com/article/show-by-day.html but when I hit url example.com/article/slug-post.html , its again point to action show.So how can I solve it?Many thanks!
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment