Thursday, June 26, 2014

Re: :action/* element is giving missing controller error

Based on what I just read in the CakePHP book, then the route definition for /blog/:action/* should mean that any URL using /blog should go to posts instead and to the same action as the one following /blog

For example:
/blog/add should give you /posts/add
/blog/view/8 should give you /posts/view/8

So based on this, please correct me if I am wrong, then you should remove the definition 'action' => 'index' in the array of the route definition.
Kindly inform us of the result :)
Enjoy, John

On Wednesday, 25 June 2014 18:56:50 UTC+3, Mansoor Ahmad wrote:
here is my route.php file when i try to access website/blog it would throw me an error saying blog controller is missing. but when i change "/blog/:action/*" to "/blog" it wil work fine what am i doing wrong ?? please help thanks.

<?php  Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));  /**  * ...and connect the rest of 'Pages' controller's URLs.  */  Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));  Router::connect('/blog/:action/*', array('controller' => 'posts', 'action' =>'index'));  /**  * Load all plugin routes. See the CakePlugin documentation on  * how to customize the loading of plugin routes.  */  CakePlugin::routes();    /**  * Load the CakePHP default routes. Only remove this if you do not want to use  * the built-in default routes.  */  require CAKE . 'Config' . DS . 'routes.php';  ?>

--
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: