How to get important url in Magento

First of all we will present you how to get skin url, get media url, get base url, get store url to retrieve an URL path in STATIC BLOCK

1. How to Get skin url

ANSWER: {{skin url=’images/sampleimage.jpg’}}


2. How to Get media url

ANSWER: {{media url=’/sampleimage.jpg’}}


3. How to Get base url

ANSWER: {{base url=’yourstore/mypage.html’}}


4. How to Get store url

ANSWER: {{store url=’mypage.html’}}

Now we will show you how to get skin url, get media url, get base url, get store url to retrieve an URL path in when using .phtml files. Encloding the following code in PHP tags is a MUST.


1. How to Get Magento Js Url

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

2. How to Get Magento Store Url

ANSWER: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);


3. How to Get Magento Skin Url

ANSWER: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);


4. How to Get Magento Media Url

ANSWER: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);


5. How to Get Magento Media Url

ANSWER: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);


6. How to Get Magento Media Url

ANSWER: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);


7. How to Get Home URL

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


8. How to Get Current URL

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


9. How to Get Secure Skin URL

ANSWER: getSkinUrl(‘images/ sampleimage.gif’, array(‘_secure’=>true)) ?>


10. How to Get Not secure Skin URL


ANSWER: getSkinUrl(‘images/sampleimage.jpg’) ?> 

No comments:

Post a Comment