I inserted 3 widget in CMS -> Pages. I have to do display those widgets in home page.
I used this code
$aCmsPage = Mage::getModel('cms/page')->load('main-page', 'identifier');
echo $theContent = $aCmsPage->getContent();
but output was like this
{{widget type="meigeewidgets/featuredcategory" featured_category="category/5" template="meigee/meigeewidgets/slider.phtml" products_amount="15" slider_speed="1000" slider_displayslideqty="4" slider_moveslideqty="1" slider_easing="easeInQuad" widget_id="7646"}}
i am new to magento. Can you please help me to find a solution?
David Manners
27.3k9 gold badges78 silver badges220 bronze badges
1 Answer 1
Did some digging through the CMS module in Magento and it seems that Mage_Cms_Block_page::_toHtml actually implements what you are looking for.
$helper = Mage::helper('cms');
$processor = $helper->getPageTemplateProcessor();
$html = $processor->filter($this->getPage()->getContent());
Now I didn't test it but it seems that this returns the page content with the rendered widgets.
answered Oct 8, 2013 at 19:28
Sander Mangel
37.6k5 gold badges81 silver badges149 bronze badges
default