How to call a cms page in a phtml file in magento?

冷暖自知 提交于 2019-12-06 10:37:52

问题


I need to display a CMS page inside my custom module's phtml file. Is there any way I can include it either through xml layout or via coding directly in phtml file? I know we can add a cms block but how can we add a cms page?


回答1:


Try the below code in your phtml file

 $page = Mage::getModel('cms/page')->load('home_page','identifier');
 echo $page->getContent();



回答2:


This code check if cms page is active then it will display page content

$page = Mage::getModel('cms/page')->load('top_offer','identifier');

echo $page->getIsActive()?$page->getContent():'';


来源:https://stackoverflow.com/questions/12816467/how-to-call-a-cms-page-in-a-phtml-file-in-magento

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!