It's not so much wrong as incomplete. Any URL *beginning* with '/
cooks/' will be handled in the above-quoted fashion. But if it begins
*and ends* with '/cooks', without another routing statement, you'll
get the error you're talking about. Have a look at the pre-defined
routing for pages that's
Thanks for the example, DragonFlyEye and thanks for the feedback
Nikhil. I have finally come to terms with needing 2 statements. In
1.2 (even if it was incomplete) it worked with one statement. The
features of 1.3 are well worth specifying 2 routes.
Thanks again!
On Aug 31, 2:17 pm,
To explain a bit why the extra route is needed. The Router in 1.2 did
a lot of black magic, guessing at what you meant instead of just doing
what you typed. This incurred a ton of overhead as it had to attempt
several different guesses at what might work for each route. Most of
the guesswork
Not sure what order you had things in, but order is important. So, you
should be able to get things working by putting these two in the
following order:
Router::connect('/blog/:action/*',
Router::connect('/blog/*', array('controller'='news_articles'));
Obviously, the /blog/* will catch all
SacoDesign is right. its not working as expected (or the cook book is
wrong)
- - Here is the same from cookbook (
http://book.cakephp.org/view/46/Routes-Configuration
)
Another common use for the Router is to define an alias for a
controller. Let's say that instead of accessing our regular URL
Thanks for the response. I still cannot get the entire directory to
respond as a controller without 2 router::connect() calls. I removed
the 'action'='index' as suggested.
Has anyone else experienced this issue? I removed every route from my
routes.php and tried the following:
Hello,
I'm upgrading my app from 1.2 to 1.3. I have several custom routes
setup like so:
Router::connect('/blog/:action/*',
array('controller'='news_articles', 'action'='index'));
This works fine, except for when the url is only /blog/. In that case
I get a cannot find blog controller error.
On Wed, Aug 25, 2010 at 9:05 AM, SacoDesign sign...@sacodesign.com wrote:
Hello,
I'm upgrading my app from 1.2 to 1.3. I have several custom routes
setup like so:
Router::connect('/blog/:action/*',
array('controller'='news_articles', 'action'='index'));
This works fine, except for when
I expected that /blog/ would route to the news_articles controller
(index action) like a call to /blog/index would do. This is the way
it worked on 1.2. Now, on 1.3, a request for /blog/ looks for the
blog controller.
Is there any way to combine the two Router::connect()'s into one?
To answer
That all looks correct, and it would be the same in 1.2. You might
write the following, though:
Router::connect('/blog*', array('controller' = 'news_articles'));
That would push all requests for the /blog directory to the right
controller, then you can create the actions you want and they'll get
10 matches
Mail list logo