Getting Skin, Media, JS, Store URL in Magento

Following is a quick note on how to get different URL’s in Magento

Getting URL using PHP code :

Base URL : Mage::getBaseUrl();
Skin URL : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
Skin URL : $this->getSkinUrl(‘images/imagename.jpg’);
Media URL : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
JS URL : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
Store URL : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Current URL : Mage::helper(‘core/url’)->getCurrentUrl();
Product Image : $_product->getImageUrl() //This can be used on detail page

Getting URL using XML code in CMS page:

Base URL :  {{store base_url=””}}
Store URL : {{store direct_url=””}}
You can link to any page using :  {{store direct_url=”test.html”}}
Skin URL : {{skin url=””}}
Media URL: {{media url=””}}

Please comment your queries, suggestion or corrections.

Advertisements

2 thoughts on “Getting Skin, Media, JS, Store URL in Magento

  1. Pingback: How to get current Page URL and Identifiers in Magento | Universal Coder

  2. Pingback: How to get current Page URL and Identifiers in Magento - Metro Style

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s