When you building application most likely there are common links within the layout. They could be in a menu, or let’s say “edit profile” and ‘logout’ links which are visible everywhere. As you probably know if you use Html Helper the link could be either Cake-relative URL or array of URL parameters.
The problem may occur if you using the second option – the array.
For example if we have link like this:
which will produce link like:
The problem came if the application uses plugins and the user is in inside the plugin. Then the generated link will be:
Which is not the correct one.
So the idea is:
if you adding links in the layout with array of URL parameters, always add an extra parameter ‘plugin’=>false to prevent problems like this.
So the link should look like:
and it will produce the correct code. Otherwise you risk to have broken links.
Pingback: CakePHP : signets remarquables du 23/04/2010 au 26/04/2010 | Cherry on the...
Not quite right. Setting the ‘plugin’ to false will yield unexpected results. Instead, use ‘plugin’ => null
example:
$this->Html->link(‘View all comments’, array(‘plugin’=>null, ‘controller’=>’comments’, ‘action’=>’index’);
You are completely right Nick, I will change the article according to your comment.
Thanks