zoukankan      html  css  js  c++  java
  • Magento-获取Skin,Media,js,Base及Store的URL路径

    获取Magento中常用的URL路径,如: skin, Media, JS, Base 和 Store URL ,并将其应用到CMS页面中
    那么我们如何在 CMS, PHP 以及 phtml 页面中获取这些URL呢

    在静态块 STATIC BLOCK 中调用URL

    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’}}
    在 PHTML 文件中调用URL 
    注意: 在编写调用代码是,不要忘记php标签
    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);
    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)

  • 相关阅读:
    python生成随机密码
    python计算md5值
    python---连接MySQL第五页
    python---连接MySQL第四页
    梯度下降(Gradient Descent)小结
    矩阵的线性代数意义
    矩阵的意义
    偏导数与全导数的关系 以及 偏微分与全微分的关系
    mysql-blog
    python及numpy,pandas易混淆的点
  • 原文地址:https://www.cnblogs.com/you-jia/p/4387101.html
Copyright © 2011-2022 走看看