Magento Get Url in block / phtml files
1.
Get Base Url :
Mage::getBaseUrl();
2.
Get Skin Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
(a) Unsecure Skin Url :
$this->getSkinUrl('images/imagename.jpg');
(b) Secure Skin Url :
$this->getSkinUrl('images/imagename.gif', array('_secure'=>true));
3.
Get Media Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
4.
Get Js Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
5.
Get Store Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Or Simply
Mage::getBaseUrl();
6.
Get Current Url
Mage::helper('core/url')->getCurrentUrl();
Get Url in cms pages or static blocks. Magento parses pre specified structures to actual URLs before rendering pages.
1.
Get Base Url :
{{store url=""}}
2.
Get Skin Url :
{{skin url='images/media.jpg'}}
3.
Get Media Url :
{{media url='/media.jpg'}}
4.
Get Store Url :
{{store url='page.html'}}
5.
Get secure Store Url :
{{store url="page.html" _secure="true"}}
No comments:
Post a Comment