How do you get the base URL programmatically?

Lets say I have my omeka instance on a server with other web applications running on the same server.
Omeka is on myserver.gov/omeka.
All is well and it works just fine, but if I’m building a theme, and I have to construct links algorithmically (the omeka plugin-specific functions don’t do exactly what I need them to do), how do I get that base URL?

Basically- how does one get the base URL from Omeka/Zend so that you don’t have to hard code it into your links?

Omeka’s bootstrap file defines many constants that will help here. Look in /bootstrap.php for the various constants defined in there, and you should see what you need. BASE_DIR is the most likely one, but others defined there might help you get more specific.

Cool! Thanks!
The one I ended up finding was CURRENT_BASE_URL

The url helper function will also do the base URL stuff for you if you just pass a string. That’s the “normal” way to do this.

What string do you pass to it?

If you pass the string for the “relative to Omeka” URL you want to write out, url() will correctly prepend the right base URL to it (handling subdirectories, whether you’re on the admin or public side, etc.)

So, url('items') would give you a working URL to the items browse page, and so on.