I created a block under CMS -> Static Blocks with the following content:
<a href="http://www.foo.com">
<img src="{{media url="wysiwyg/email/751-footer.png"}}"/>
</a>
Unfortunately the media directive interprets to
src="{{media url=" when I try to load the CMS Block via
$signaturemodel = Mage::getModel('cms/block')->load('email_signature');
$signature = $signaturemodel->hasData() ? $signaturemodel->getContent() : "";
echo $signature;
Is there any chance to get the correct media url?
pbaldaufpbaldauf
asked Jan 24, 2017 at 12:02
1 Answer 1
There are different solutions depending on the context.
e.g.
// use thestatic block email_signature
$signature = '';
$block = Mage::getModel('cms/block')
->setStoreId(Mage::app()->getStore()->getId())
->load('email_signature');
if ($block->getIsActive()) {
/* @var $helper Mage_Cms_Helper_Data */
$helper = Mage::helper('cms');
$processor = $helper->getBlockTemplateProcessor();
$signature = $processor->filter($block->getContent());
}
echo $signature;
or in a .phtml-File
echo $this->getLayout()->createBlock('cms/block')
->setBlockId('email_signature')
->toHtml();
For better understanding have a look at app/code/core/Mage/Cms/Block/Block.php
answered Jan 24, 2017 at 12:48
Explore related questions
See similar questions with these tags.
default