How to get Dynamic URLs in Magento PHTML

The following are methods to get the Magento Base URL, Magento Skin URL, Magento Media URL, Magento Js URL, to get the route URL, use either of the following codes:
|
1 |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); |
|
1 |
$this->getUrl(); |
Returns: http://yourstore.com/index.php/
Magento Store Media URL
|
1 |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); |
Returns: http://yourstore.com/media/
Magento Theme Skin URL
|
1 |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); or you can write $this->getSkinUrl(); |
Returns: http://yourstore.com/skin/
Current Magento Store URL
|
1 |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); |
Returns: http://yourstore.com/
Magento JS URL
|
1 |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); |
Returns: http://www.yourstore.com/js


