Magento : Get Skin and Media URLs

  • Avinash
  • 2
  • Aug 06, 2012
  • Web Development

In this article we will see; in Magento how we can get Skin, Media and Other URLs in Static block and .phtml file.

In one of the earlier article we have seen 4 ways to get Magento Homepage URL. Now in this article we will see how to get Skin, Media URL in .phtml file and static block.

So Let’s start with the Static block first:

Get Media URL in Static Block – Magento

{{media url=''}}
{{media url=''}}

If you want to get something added after media URL then you just need to place below code instead.

{{media url='images/logo.jpg'}}
{{media url='images/logo.jpg'}}

Get Skin URL in Static Block – Magento

{{skin url='images/sampleimage.jpg '}}
{{skin url='images/sampleimage.jpg '}}

If you want to get something added after skin URL then you just need to place below code instead.

{{skin url='images/logo.jpg'}}
{{skin url='images/logo.jpg'}}

Get Homepage URL in Static Block – Magento

{{config path="web/unsecure/base_url"}} {{config path="web/secure/base_url"}}
<!-- Non Secure URL -->
{{config path="web/unsecure/base_url"}}

<!-- Secure URL -->
{{config path="web/secure/base_url"}}

Get Skin URL in .phtml File – Magento

// Non Secure URL echo $this->getSkinUrl(''); // Secure URL echo $this->getSkinUrl('', array('_secure'=>true)); // If you want something added behind the URL echo $this->getSkinUrl('image.jpg');
// Non Secure URL
echo $this->getSkinUrl('');

// Secure URL
echo $this->getSkinUrl('', array('_secure'=>true));

// If you want something added behind the URL
echo $this->getSkinUrl('image.jpg');

Get Media URL in .phtml File – Magento

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);

Stay tuned with us on Twitter, Facebook and Email for more tips and tricks for magento.

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by:

  • MM

    helps a lot, thx…..

  • Wahlers

    Magnificent goods from you, man. I’ve be mindful your stuff prior to and you are just too great. I actually like what you have received here, certainly like what you’re saying and the way through which you assert it. You are making it enjoyable and you still take care of to stay it sensible. I can not wait to read much more from you. This is actually a terrific website.