Skip to content

Instantly share code, notes, and snippets.

@boywhoroared
Created June 6, 2011 16:33
Show Gist options
  • Save boywhoroared/1010593 to your computer and use it in GitHub Desktop.
Save boywhoroared/1010593 to your computer and use it in GitHub Desktop.
Using the Zend View URL Helper to generate default route URLs
<?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