简体   繁体   中英

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

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?

Try the below code in your phtml file

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

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():'';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM