Magento: Get skin URL, get media URL, get base URL, get store URL

Source: Internet
Author: User

Magento mage core, admin static blocks, or phtml edits are usually supported des getting URL path such images, JavaScript, base URL, media and store URL. there are different ways to retrieve mentioned URL paths depending on where section you're editing.

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);

 

Posted in: magento
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.