i want get content in CMS Block, i tryed this code but it not show content

My code :

<?php foreach ($this->getAgreements() as $_a): ?>
     <?php echo $_a->getContent() ?>
<?php endforeach ?>

It not show content, but show this:

{{block type="cms/block" block_id="gs_business_terms"}}
  • +1 for answer acceptance :) – Shoaib Munir Aug 2 '19 at 10:22

Use this code to echo content of cms block

<?php foreach ($this->getAgreements() as $_a): ?>
     <?php echo Mage::helper('cms')->getPageTemplateProcessor()->filter($_a->getContent());?>
<?php endforeach ?>

This should work

  • 1
    thank you very much, it work for me! have a nice day Shoaib Munir – TN98 Aug 2 '19 at 10:19

You can call like this one.

<?php foreach ($this->getAgreements() as $_a): ?>
     <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($_a->getIdentifier())->toHtml(); 
<?php endforeach ?>

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.