Reputation: 67888
So I have "domain.com/user/logout" as the logout action. If I were to put this in view, and if I changed somethings in routers, would I have change all the view(s) as well to reflect the new changes? Wouldn't that mean that the best way to actually use an action is to call the action via PHP? or am I missing something?
Upvotes: 0
Views: 58
Reputation: 308
You want to use the url view helper. You can specify a named route and of course the module, controller, action and params you want the link to have.
EDIT: In your view script do the following:
<?php echo $this->url(array(
'module' => 'moduleToCall',
'controller' => 'controllerToCall',
'action' => 'actionToCall',
'namedParam' => 'whateveryouwantittobe'
), 'routeName', $resetLink = false
); ?>
EDIT2 I couldn´t find the url helper in the docs but you might just want to take a look at the source code.
The Url viewhelper is located in /path/to/your/copyof/Zend/View/Helper/Url.php
Upvotes: 3