- class Omeka_View_Helper_Url¶
- url($options = Array, $name, $queryParams = Array, $reset =, $encode = 1)¶
Generate a URL for use in one of Omeka’s view templates.
There are two ways to use this method. The first way is for backwardscompatibility with older versions of Omeka as well as ease of use fortheme writers.
Here is an example of what URLs are generated by calling the function indifferent ways. The output from these examples assume that Omeka isrunning on the root of a particular domain, though that is of noimportance to how the function works.
echo $this->url('items/browse'); // outputs "/items/browse"
echo $this->url(‘items/browse’, array(‘tags’=>’foo’)); // outputs “/items/browse?tags=foo”
echo $this->url(array(‘controller’=>’items’, ‘action’=>’browse’)); // outputs “/items/browse”
echo $this->url(array(‘controller’=>’items’, ‘action’=>’browse’),’otherRoute’,array(‘tags’=>’foo’),);// outputs “/miscellaneous?tags=foo”</code>
The first example takes a URL string exactly as one would expect it tobe. This primarily exists for ease of use by theme writers. The secondexample appends a query string to the URL by passing it as an array. Notethat in both examples, the first string must be properly URL-encoded inorder to work. url(‘foo bar’) would not work because of the space.
In the third example, the URL is being built directly from parameterspassed to it. For more details on this, please see the Zend Framework’sdocumentation.
In the last example, ‘otherRoute’ is the name of the route being used, asdefined either in the routes.ini file or via a plugin. For examples ofhow to add routes via a plugin, please see Omeka’s documentation.
- $options (unknown) –
- $name (unknown) –
- $queryParams (unknown) –
- $reset (unknown) –
- $encode (unknown) –