dousi0144 2011-12-20 20:29
浏览 74
已采纳

Magento - {{...}}占位符被替换在哪里?

I'm creating some custom blocks and I want to support the {{skin url="..."}} dynamic placeholder features of Magento inside the Layout Update XML.

Ex:

<action method="setImageSrc">
    <name><![CDATA[{{skin url=images/banners/MyBanner.jpg}}]]></name>
</action>

Inside my block class I grab the variables (i.e. $this->getImageSrc()), build the HTML, and output it. Unfortunately, it's literally outputting {{skin url="..."}}. Where does that translation get performed? Is that something I can just pass my HTML through to clean it up before outputting? If so, how?

NOTE: I've tried with and without CDATA as well as with and without quotes around the URL. Nothing works...some break it worse than others

  • 写回答

1条回答 默认 最新

  • dousao2186 2011-12-20 21:24
    关注

    Thanks to the information from @clockworkgeek I have figured this one out. These 2 resources explain it very well...except how to use it.

    Magento CMS Syntax

    How Do Template Tags Work

    In order to actually use this it is VERY simple. I simply made my own _toHtml() method in my custom block class as follows:

    public function _toHtml()
    {
        $processor = Mage::getModel('core/email_template_filter');
        return $processor->filter(parent::_toHtml());
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题