magento获取Skin,Media,js,Base,Store的URL路径

获取Magento中常用的URL路径,

如: skin, Media, JS, Base 和 Store URL ,并将其应用到CMS静态页面中

  在静态块 STATIC BLOCK 中调用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’}}

  在 PHTML 文件中调用URL
  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 Home URL
   $home_url = Mage::helper(‘core/url’)->getHomeUrl();

  //Get Magento Media URL http://www.domain.com/media/
  Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);

  //Get Magento index.php http://www.domain.com/index.php/
  Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);

  //Get Magento Skin URL http://www.domain.com/skin/
  Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

//Get Magento Store URL http://www.domain.com/
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);

//Get Magento Js URL http://www.domain.com/js/
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

Magento获取当前页面URL
$currentUrl = $this->helper('core/url')->getCurrentUrl();

posted @ 2014-01-11 18:42  lifeinearth  阅读(1412)  评论(0编辑  收藏  举报