Created
June 6, 2011 16:33
-
-
Save boywhoroared/1010593 to your computer and use it in GitHub Desktop.
Using the Zend View URL Helper to generate default route URLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# When using the Zend View URL helper to generate URLs to controller actions, | |
# rather than named routes, you have to use 'default' as the route name. | |
# Generating a URL for the `bar` action in the `foo` controller. | |
echo $this->url(array('action' => 'bar', 'controller' => 'foo'), 'default', true); | |
# And NOT this as most people seem to assume (self included). | |
echo $this->url(array('action' => 'bar', 'controller' => 'foo'), null, true); | |
# Using null tells Zend NOT to use a route apparently. | |
#It doesn't seem to be documented in manual or the API. If it is, I haven't seen it. | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment