Useful Magento Base Path References

Get Paths and URLs in phtml files

Usage Snippet
This snippet is best used within your .phtml templates within magento so you aren’t hardcoding links

<?php
echo Mage::getUrl('contact-us/');
?>
Get Base URL
<?php
echo Mage::getBaseUrl();
?>
Get Skin URL
<?php
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
?>
Get Media URL
<?php
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
?>
Get JS URL
<?php
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
?>
Get Current URL
<?php
echo Mage::helper('core/url')->getCurrentUrl();
?>

Aaron Ware

Over the past decade Aaron Ware has worked with leading brands, start-ups and everyone in between to develop innovative, highly interactive, feature-rich websites and online apps.

| @aaronware