How can I show the home page cms content inside a block? For instance, I have this content in my cms home page,

<p>welcome to my home page.</p>

And I want to insert this content inside a block called 'carousel',

this is my page.xml,

<default translate="label" module="page">
    <label>All Pages</label>
    <block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
        <block type="core/template" name="carousel" as="carousel" template="page/html/carousel.phtml">
            <label>Bootstrap Carousel</label>
            <block type="core/text_list" name="content" as="content" translate="label">
                <label>Main Content Area</label>

And this is my local.xml,

   <reference name="carousel">
        <block type="cms/block" name="cms_page_content">
            <action method="setBlockId">

Nothing is being printed out.

Any ideas?


Using a static block,


<reference name="carousel">
            <block type="cms/block" name="carouselx" before="carousel.content">
                <action method="setBlockId">

1 Answer 1


I guess you are mixing CMS blocks and pages. The home page content is as CMS page and what you are doing in your local.xml is adding a CMS block.

So you have two options. Either create a new CMS block inside of Magento admin or create your custom block type, pull the content of the CMS page there and then display it.

If you are not quite experienced with Magento I would suggest the first approach.

To create your custom block type you have to create a module (this answer will not cover it) and inside you have to create a block class with the following content:


class YourPackage_YourModule_Block_Page extends Mage_Core_Block_Template
    public function getContent()
        $page = Mage::getModel('cms/page');

        return $page->getId() ? Mage::helper('cms')->getPageTemplateProcessor()->filter($page->getContent()) : '';

Then in your local.xml you can add your block to any exiting layout like this:

<reference name="...">
    <block type="your_module_alias/page" name="block_name" template="cms/cms-page-content.phtml">
        <action method="setPageId"><page_id>your_page_identifier</page_id></action>

And at last in your template at base/default/templates/cms/cms-page-content.phtml:

<?php $this->getContent() ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.