Web design company India | Custom web development company India

How to get Urls in Magento

  • How to get  Urls in Magento

    Magento core url helper allows you to get current url. To get current url in magento you just need one line of code as below: ref: public function getCurrentUrl()

    $magentoCurrentUrl = Mage::helper('core/url')->getCurrentUrl();
    You can also get current url as base64 encoded url as:
    $magentoCurrentUrlBase64 = Mage::helper('core/url')->getCurrentBase64Url(); or,
    $magentoCurrentUrlBase64 = Mage::helper('core/url')->getEncodedUrl($url); // $url is optional
    Same helper allows you to get home url which is base url:
    $magentoHomeUrl = Mage::helper('core/url')->getHomeUrl();
    Source: app\code\core\Mage\Core\Helper\Url.php To Retrieve URL path in STATIC BLOCK To get SKIN URL
    {{skin url='images/sampleimage.jpg'}}
    To get Media URL
    To get Store URL
    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:
    getSkinUrl('images/sampleimage.jpg') ?>
    Secure Skin URL
    getSkinUrl('images/ sampleimage.gif', array('_secure'=>true)) ?>
    Get Magento Media Url
    Get Magento Skin Url
    Get Magento Store Url
    Get Magento Js Url

  • Post Comments

    Submit Comment

    * Required Fields