Search code examples
phpmagentomagento-1.5

Magento - Where do {{...}} placeholders get replaced?


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


Solution

  • 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());
    }