Magento
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:
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
$this->getUrl();
Returns: http://yourstore.com/index.php/
Magento Store Media URL
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
Returns: http://yourstore.com/media/
Magento Theme Skin URL
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); or you can write $this->getSkinUrl();
Returns:Â http://yourstore.com/skin/
Current Magento Store URL
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Returns:Â http://yourstore.com/
Magento JS URL
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
Returns: http://www.yourstore.com/js
Advertisement




