Problem with CMS code in Magento

boris.creing
2 Posts
boris.creing posted this 03 May 2017

Why is it that the code for the CMS static block call is shown as a plain text on the page?

In themelr I have insterted between php tags :

"
$staticBlock = Mage::getModel('cms/block')->load('blog_home');
echo $staticBlock->getTitle(); // block title
echo $staticBlock->getContent(); // block content
"

on the page it shows as:

{{widget type="blog/last" blocks_count="2" categories="1"}}

Why is it that the code for the CMS static block call is shown as a plain text on the page? In themelr I have insterted between php tags : " $staticBlock = Mage::getModel('cms/block')->load('blog_home'); echo $staticBlock->getTitle(); // block title echo $staticBlock->getContent(); // block content " on the page it shows as: {{widget type="blog/last" blocks_count="2" categories="1"}}
Vote to pay developers attention to this features or issue.
4 Comments
Order By: Standard | Newest
Support Team
Support Team posted this 04 May 2017

Hi,

This code is to output static blocks. It works just fine on my side.
Where exactly you added CMS code control with this code?
What is the content of the static block widget? Looks like this is the line you provided:
{{widget type="blog/last" blocks_count="2" categories="1"}}
I found the same code in the following topic:
https://forum.aheadworks.com/posts-from-wrong-category-displays-in-widget-t3698.html
Do you use some third-party extension for Blog/Posts?
Does it work with the details Magento theme?

Thank you,
Olivia

Hi, This code is to output static blocks. It works just fine on my side. Where exactly you added CMS code control with this code? What is the content of the static block widget? Looks like this is the line you provided: `{{widget type="blog/last" blocks_count="2" categories="1"}}` I found the same code in the following topic: https://forum.aheadworks.com/posts-from-wrong-category-displays-in-widget-t3698.html Do you use some third-party extension for Blog/Posts? Does it work with the details Magento theme? Thank you, Olivia
boris.creing
2 Posts
boris.creing posted this 04 May 2017

This is what I want to do. Insert a CMS static block on Home page. The static block is created in Magento backend, the name of it is correct. The CMS static block contains new product widget and nothing else. When I use suggested code form (https://answers.themler.com/articles/67124/how-to-show-magento-static-block) it returns {{widget type="catalog/product_widget_new" display_type="new_products" products_count="3" template="catalog/product/widget/new/content/new_grid.phtml"}} as result (the exact text is displayed). And it is the same if I use third-party extension or native Magento widget.

This is what I want to do. Insert a CMS static block on Home page. The static block is created in Magento backend, the name of it is correct. The CMS static block contains new product widget and nothing else. When I use suggested code form (https://answers.themler.com/articles/67124/how-to-show-magento-static-block) it returns {{widget type="catalog/product_widget_new" display_type="new_products" products_count="3" template="catalog/product/widget/new/content/new_grid.phtml"}} as result (the exact text is displayed). And it is the same if I use third-party extension or native Magento widget.
Support Team
Support Team posted this 04 May 2017

Hi,

Please try to output static block with a little different code:

<?php
echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('myblock')->toHtml();
?>

If you simply need to show new products on the Home page please try Themler Product Slider control (Insert tab >> More). Then configure the new slider under the Magento Admin panel >> BillionThemes >> Settings >> Slider.

Thank you,
Olivia

Hi, Please try to output static block with a little different code: `<?php echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('myblock')->toHtml(); ?>` If you simply need to show new products on the Home page please try Themler Product Slider control (Insert tab >> More). Then configure the new slider under the Magento Admin panel >> BillionThemes >> Settings >> Slider. Thank you, Olivia
tombantom629
40 Posts
tombantom629 posted this 24 June 2026

EPFO Member Portal Guide helps users access and manage their EPF account online with ease. Learn how to log in using your UAN, check PF balance, download passbooks, track claims, and update KYC details. This guide provides simple step-by-step instructions for making the most of EPFO’s online services.

[EPFO Member Portal Guide][1] helps users access and manage their EPF account online with ease. Learn how to log in using your UAN, check PF balance, download passbooks, track claims, and update KYC details. This guide provides simple step-by-step instructions for making the most of EPFO’s online services. [1]: https://epfoin.com/
You must log in or register to leave comments