Get Base URL,Current URL,Skin URL,Store URL,Js URL: Magento

magent-base-url

This post will help you to get Base URL, Current URL, Skin URL, Store URL, Js URL, Media URL in phtml files, CMS pages and static blocks.

Get URL in phtml files:

1. Base URL

Mage::getBaseUrl();

2. Skin URL

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

a)Unsecure Skin URL

$this->getSkinUrl(‘css/styles.css’);

b)Secure Skin URL

$this->getSkinUrl(‘css/styles.css’, array(‘_secure’=>true));

3. Js URL

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

4. Current URL

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

5. Store URL

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);

6. Media URL

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);

 

Get URL in CMS pages and Static Blocks:

1. Base URL

{{store url=“”}}

2. Skin URL

{{skin url=”css/styles.css”}}

3. Store URL

{{store url=”newpage.html”}}

4. Media URL

{{media url=”/imagename.png”}}

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>