【问题标题】:Get Magento config information获取 Magento 配置信息
【发布时间】:2010-10-28 21:48:20
【问题描述】:

我正在尝试从 Magento 配置中获取基本 url 和媒体目录,并且我正在尝试将它们用于具有图像的模板。我只知道Mage::getConfig()。我不知道下一步该做什么......

【问题讨论】:

    标签: php templates configuration magento


    【解决方案1】:
    Mage::getBaseDir ($type='base')
    

    http://freegento.com/doc/d8/dcb/class_mage.html#7c9023c03db151ba782ec95ab289f2fe

    也可以

    <?php echo Mage::getURL('customerfolder/subfolder')."images/payment_types.gif" ?>
    

    这将返回将返回http://www.yourdomain.com/customerfolder/subfolder

    【讨论】:

    • 在函数之后连接路径可能会出现问题,在某些情况下,getUrl 可能会附加查询字符串(如 SID 值),这会妨碍路径的其余部分。相反,您应该使用Mage::getUrl('', array('_direct'=&gt;'customerfolder/subfolder/images/payment_types.gif', '_type'=&gt;'direct_link'))。见magentocommerce.com/wiki/5_-_modules_and_development/reference/…
    猜你喜欢
    • 1970-01-01
    • 2011-06-07
    • 2017-04-19
    • 1970-01-01
    • 1970-01-01
    • 2011-02-12
    • 1970-01-01
    • 2013-05-29
    • 1970-01-01
    相关资源
    最近更新 更多