I am using CakePHP 1.3. I have a product model. Among the database tables there are fields idand slug.
If I have a product id:37and slug:My-Product-TitleI need the product url:
Products / 37 / My-Product-Title
Instead of standard:
products / view / 37
I created a route that looks like this:
Router::connect(
'/products/:id/:slug',
array('controller' => 'products', 'action' => 'view'),
array('pass' => array('id'), 'id' => '[0-9]+')
);
Now I can go on http://server/products/37/My-Product-Title, and he will take me to the right place.
But how do I get reverse routing to automatically create the correct url in $HtmlHelper->link?
When i use:
echo $html->link(
'Product 37',
array('controller'=>'products', 'action' => 'view', 37)
);
It still outputs the standard products/view/37url.