Current magento version – 184.108.40.206
Magento had some very handy functions that easily allow you to find some fundamental urls of your site from your phtml files so you can avoid hardcoding them. These are:
- $this->getBaseUrl() – returns the base url of your store (funnily enough)
- $this->getSkinUrl() – returns the url of the folder containing your css, images and local js files (eg skin/frontend/default/your_theme, will vary depending on what package and theme the page is using).
So to find the image logo.gif in the images folder you would call
$this->getSkinUrl('images/logo.gif');. It should be noted that if getSkinUrl does not find the file that you have specified (like images/logo.gif) then it will default to looking in the default theme folders rather than your custom theme folders.
- $this->getJsUrl() – returns the url of the main js folder. So if you want to include a new js library from a template you can use this.
There are probably a few other functions like this, and some variations including some that use the Mage_Core_Model_Store, but there are the ones that I use most often.