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

Hans-Eirik Hanifl

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

Related Articles

Leave a Reply

Advertisement
Back to top button
Sign up to the E-Commerce Gorilla newsletter for updates & special promotions.
Join Our Newsletter
SUBSCRIBE
We value your privacy and protect your information like our own. Unsubscribe at anytime.