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

Magento get base url, skin url, media url, store url
()

1. Path Retrieval in Static Block or CMS Page

Get Base Url:

{{base url=''}} 

Get Store Url:

 {{store url='custom-page.html'}}

Get Media Url:

{{media url='/img.jpg'}}

Get Skin Url:

{{skin url='css/style.css'}}

 

2. Path Retrieval in phtml files

Get Base Url:

 <?php echo $this->getUrl();  ?>  

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

 <?php $current_url = Mage::helper(‘core/url’)->getCurrentUrl(); ?> 

Get Home URL

 <?php $home_url = Mage::helper(‘core/url’)->getHomeUrl(); ?> 

Get Magento Media Url

 <?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);  
 Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?> 

Get Magento Skin Url

 <?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?> 

Get Magento Store Url

 <?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?> 

Get Magento Js Url

 <?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?> 

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

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