Search This Blog

Apr 13, 2011

Magento: get skin url, get media url, get base url, get store url

Magento Mage Core, Admin Static Blocks, or Phtml edits are usually includes getting url path such images, javascript, base url, media and store url. There are different ways to retrieve mentioned URL paths depending on where section you’re editing.

To Retrieve URL path in STATIC BLOCK

{{skin url='images/sampleimage.jpg'}}
To get Media URL
{{media url='/sampleimage.jpg'}}
To get Store URL
{{store url='mypage.html'}}
To get Base URL
{{base url='yourstore/mypage.html'}}

TO Retrieve URL path in PHTML

Note: In editing PHTML don't forget to enclode the following code with PHP tag
Not secure Skin URL:
<?php echo $this->getSkinUrl('images/sampleimage.jpg') ?>
Secure Skin URL
<?php echo $this->getSkinUrl('images/ sampleimage.gif', array('_secure'=>true)) ?>
Get  Current URL
$current_url = Mage::helper('core/url')->getCurrentUrl();
Get Home URL
$home_url = Mage::helper('core/url')->getHomeUrl();
Get Magento Media Url


Get Magento Media Url

Get Magento Skin Url
Get Magento Store Url
Get Magento Js Url


Website Laten Maken said...

Very useful post.thank you

SEO Services said...

You gave me some good information about the URL path. thanks keep on updating.

Resell SEO said...

I could definitely use this to retrieve url paths. Thanks for this short illustrative guide.

Pete Diamond Rings said...

I needed this so badly. Thank you so much. Toggling between all these Magento URLs can be a pain sometimes.

Chirag Nandaniya said...

how we can get Skin Url in helper??

Janzell Jurilla said...

You welcome Pete. :)

Janzell Jurilla said...

Good point. I probably make a benchmark on that.

Sydney web designer said...

I am really forever saying that its difficult to get good honest help, but here is …

Seven Codes said...

very useful information

thank you guys....

Web Marketing Australia said...

This is what I really needed! Thanks for sharing this info. :-)

Anonymous said...

Thanks for sharing this Janzell. It's really helpful.

Anonymous said...

Dude ,

Its not working for {{base url='yourstore/mypage.html'}} ,,

Please let me know how to get base URL ..

I need to change store using CMS-Page.

Please help me out ..

Thanks in advance

Janzell Jurilla said...


Sorry for the confusion. Basically, to get the base url, you just need the following

{{base url=''}}

Mathew Porter said...

Great resource, I use this as a point of reference when developing Magento sites all the time. Thanks.

Anonymous said...

Be carefull, tehere is white space in this expresion {{skin url='images/sampleimage.jpg'}} remove it!

Ankur Jain said...

Thanks for this useful information... :)

kodulehe tegemine said...

Bookmarked! Thanks!

Alan said...

Thanks for this article. I've bookmarked it because I always forget how to get base url and skin url.

Frank said...

Perfect. Bookmarked, printed, memorized ... said...

Bookmarked and used everyday !!