Skip to main content

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

To Retrieve URL path in STATIC BLOCK

To get SKIN URL
{{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

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);

Get Magento Media Url

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
Get Magento Skin Url
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
Get Magento Store Url
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Get Magento Js Url
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

Comments

Popular posts from this blog

How to Call Newsletter in footer in Magento

To show Newsletter in footer go to app/design/frontend/default/YourTheme/layout/newsletter.xml and add the following lines in default < reference name = "footer" > < block type = "newsletter/subscribe" name = "footer.newsletter"   template = "newsletter/subscribe.phtml" /> </ reference > and add the following line in app/design/frontend/default/YourTheme/template/page/html/footer.phtml <?php echo $this -> getChildHtml ( 'footer.newsletter' ) ; ?>

Smooth Page Scroll Script

< script > $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')  && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); }); </ script >