I have several prefixes in play in an existing CakePHP app. I also have a bit of primary navigation in the layout that points to shared methods. I know I can explicitly set each prefix to false to avoid linking with the prefix, but is there a shortcut path that simply tells Cake to no use any prefixes no matter which one’s context may currently exist?
For example, I’m on a page where a realtor can register (/realtor/users/register). I have a similar prefix for inspectors and contractors because the registration process is slightly different. Since I’m not authenticated, there’s a Login link in the primary nav, but the login action is shared by all user types and should be accessed without any prefix.
<?php echo $this->Html->link( 'Login', array( 'controller' => 'users', 'action' => 'login', 'realtor' => false, 'inspector' => false, 'contractor' => false ) ) ?>
I’d like to be able to, in the link, just turn off all prefixing rather than turning off each possible prefix independently. Possible?
If loosing the routing capabilities is not a problem for you, you could pass a string instead of an array to the link() method:
EDIT
To keep routing mechanism, here is a little Helper that would do the trick:
Off course you could change the method name if you want to keep the standard link() method. I tested this with Cake2, but this should work with Cake1.3