How to Get URL Paths for Skin, Media, JS, Base & Store URL in Magento

Tips to get Magento URL paths of skin, Media, JS, Base and Store URL in CMS pages for Magento customization or programming. How we can retrieve URL path from static blocks in CMS, PHP and phtml pages To Retrieve URL path in STATIC BLOCK To get SKIN URL

1
{{skin url=’images/sampleimage.jpg ‘}}
To get Media URL

1
{{media url=’/sampleimage.jpg’}}
To get Store URL

1
{{store url=’mypage.html’}}
To get Base URL

1
{{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

1
<?php echo $this->getSkinUrl(‘images/sampleimage.jpg’) ?>
Secure Skin URL

1
<?php echo $this->getSkinUrl(‘images/ sampleimage.gif’, array(‘_secure’=>true)) ?>
Get Current URL

1
$current_url = Mage::helper(‘core/url’)->getCurrentUrl();
Get Home URL

1
$home_url = Mage::helper(‘core/url’)->getHomeUrl();
Get Magento Media URL

1
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
or

1
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
Get Magento Skin URL

1
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
Get Magento Store URL

1
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Get Magento Js URL

1
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

0 comments:

Post a Comment