I'm trying to setup the following routing in cakePHP 2.3:
domain/news/slug
I've followed the cookbook guidelines on routing and the route that gets created is correct. The problem I run into is that when selecting the link I get the 'Missing Method in NewsController' error message.
Here's what I've configured:
Router::connect(
'/news/:slug/',
array('controller' => 'news', 'action' => 'view'),
array(
'pass' => array('slug'),
'slug' => '[^_]+'
)
);
I'm passing in the slug with a regular expression (any string that does not include an underscore).
This is my link in the index page:
<?php echo $this->Html->link(
$news['News']['title'],
array(
'controller' => 'news',
'action' => 'view',
'slug' => $news['News']['slug']
)
); ?>
As mentioned, the URL is built correctly, and looks like this: /news/test-slug-news-story
But when I click on it I get the 'Missing Method in NewsController' error message
Is it obvious what I'm missing, cause I've looked at this too long to be able to see it.
Thanks, Paul