Skip to content

Instantly share code, notes, and snippets.

@pauldonnelly
Last active August 29, 2015 14:08
Show Gist options
  • Save pauldonnelly/2faa24d46db29d84e7ed to your computer and use it in GitHub Desktop.
Save pauldonnelly/2faa24d46db29d84e7ed to your computer and use it in GitHub Desktop.
Get Magento URLS
Get Url in phtml files
1. Get Base Url :
<?php echo Mage::getBaseUrl(); ?>
2. Get Skin Url :
<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>
(a) Unsecure Skin Url :
<?php echo $this->getSkinUrl('images/imagename.jpg'); ?>
(b) Secure Skin Url :
<?php echo $this->getSkinUrl('images/imagename.gif', array('_secure'=>true)); ?>
3. Get Media Url :
<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>
4. Get Js Url :
<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>
5. Get Store Url :
<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>
6. Get Current Url
<?php echo Mage::helper('core/url')->getCurrentUrl(); ?>
Get Url in cms pages or static blocks
1. Get Base Url :
{{store url=""}}
2. Get Skin Url :
{{skin url='images/imagename.jpg'}}
3. Get Media Url :
{{media url='/imagename.jpg'}}
4. Get Store Url :
{{store url='mypage.html'}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment