Functions/uri

Returns a URL to a page in an Omeka site. This function can be used to create links between different pages on the site.

Plugin and theme writers should always use this helper when linking between pages. Hand-written or "bare" URLs are generally only valid for a particular Omeka installation. This helper generates relative URLs that are valid regardless of where an Omeka installation is located on a server.

Usage

<?php uri($options, $route, $queryParams, $reset, $encode); ?>

Arguments

  • $options (string or array)(optional, default: empty array)
    • If a string is passed it is treated as an Omeka-relative link. So, passing 'items' would create a link to the items page.
    • (Advanced) If an array is passed (or no argument given), it is treated as options to be passed to Omeka's routing system.
  • $route (string)(optional, default: null) The route to use if an array is passed in the first argument.
  • $queryParams (array)(optional, default: empty array) A set of query string parameters to append to the URL
  • $reset (boolean)(optional, default: false) Whether Omeka should discard the current route when generating the URL.
  • $encode (boolean)(optional, default: true) Whether the URL should be URL-encoded

Return Value

(string) URL.

Example(s)

There are many possible arguments above, but the general usage of this helper is simple.

To print a URL pointing to Omeka's items page:

<?php echo uri('items'); ?>

Source File/Version

  • application/helpers/UrlFunctions.php since Omeka 1.0