0

I have a static block defined in magento's backend

<p><a href="#"><img src="{{skin url="images/fb_follow.png"}}" alt="fb" /></a> <a href="#"><img src="{{skin url='images/tw_follow.png'}}" alt="fb" /></a> <a href="#"><img src="{{skin url='images/dots_follow.png'}}" alt="fb" /></a> <a href="#"><img src="{{skin url='images/feed.pngs'}}" alt="fb" /></a></p>

This is how i call it in one of the templates

$this->getLayout()->createBlock('cms/block')->setBlockId('header_links')->toHtml()

The output (it is not rendering the {{}} parts..

<p><a href="#"><img src='{{skin url="images/fb_follow.png"}}' alt="fb" /></a> <a href="#"><img src="{{skin url='images/tw_follow.png'}}" alt="fb" /></a> <a href="#"><img src="{{skin url='images/dots_follow.png'}}" alt="fb" /></a> <a href="#"><img src="{{skin url='images/feed.pngs'}}" alt="fb" /></a></p>
  • {{}} is not rendered.it convert to url of skin just {{skin url="images/fb_follow.png"}}=www.example.om/skin/frontend/yourpackage/yourtemplate/images/fb_follow.png – Amit Bera Feb 10 '14 at 11:15
0

I think the problem is that instead of double quotes you use single

<img src='{{skin url="images/fb_follow.png"}}' alt="fb" />

Because the html output will be like this

<img src="http://localhost/skin/frontend/base/default/"fb_follow.png"" alt="fb">

Where image path was build not correctly.

Try to use double

<img src="{{skin url="images/fb_follow.png"}}" alt="fb" />
0

Sorry for bothering, my problem was, i was referencing wrong block in

$this->getLayout()
         ->createBlock('cms/block')
         ->setBlockId('header_links')
         ->toHtml();

The actual block content was outputed as is without template processing

$content = Mage::getModel('cms/block')
               ->setStoreId(
                    Mage::app()->getStore()->getId()
               )->load('follow-me')
               ->getContent();

Using template processor like in Mage_Cms_Block_Block::_toHtml solved my problem

$html = Mage::helper('cms')
            ->getBlockTemplateProcessor()
            ->filter($content);
  • If this solved your problem please mark it as answered. – philwinkle Feb 11 '14 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.