Cameron
Cameron

Reputation: 28793

CakePHP Routing help

I have the following link: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' => 'portfolio', 'action' => 'view', Tiny::toTiny($post['Portfolio']['id']), Inflector::slug($post['Portfolio']['title'])), array('title' => $post['Portfolio']['title'])); ?>

which creates urls like http://driz.co.uk/portfolio/view/3z/Paperview_Magazine

BUT I want to remove the view part of the url via the routing system. So far I have implemented this:

Router::connect('/portfolio/id:/slug:', array('controller' => 'portfolio', 'action' => 'view', 'id', 'slug'));

But it doesn't work. Can anyone help?

Upvotes: 1

Views: 92

Answers (1)

Francois Deschenes
Francois Deschenes

Reputation: 24969

You should try this:

Router::connect('/portfolio/*', array('controller' => 'portfolio', 'action' => 'view'));

Upvotes: 1

Related Questions