Get base Url, Skin Url, Media Url in both phtml files and cms pages or static blocks – Magento 1x

I have been searching on the web for these helpful codes for Magento 1x and I have gathered them together here for my
own purpose. But if you want to use these codes in your project then please go ahead.

Get the URL in CMS pages and Static Blocks

1. Base URL

 {{store url=""}}

2. Skin URL

 {{skin url='imagefolder/image.png'}}

3. Media URL

 {{media url="/image.png"}}

4. Store URL

 {{store url="pagename.html"}}

Get the URL in phtml file

1. Base URL

 Mage::getBaseUrl();

2. Skin URL

 Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

2.1 Secure URL

 $this->getSkinUrl('imagefolder/image.png', array('_secure'=>true));

2.2 Unsecure URL

 $this->getSkinUrl('imagefolder/image.png');

3. Current URL

 Mage::helper('core/url')->getCurrentUrl();

4. Js URL

 Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

5. Store URL

 Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);

6. Media URL

 Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);

Related Posts: