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>
</block>
</block>
</default>
And this is my local.xml,
<reference name="carousel">
<block type="cms/block" name="cms_page_content">
<action method="setBlockId">
<block_id>cms_page_content</block_id>
</action>
</block>
</reference>
Nothing is being printed out.
Any ideas?
EDIT:
Using a static block,
local.xml,
<reference name="carousel">
<block type="cms/block" name="carouselx" before="carousel.content">
<action method="setBlockId">
<block_id>carousel</block_id>
</action>
</block>
</reference>
Best Answer
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:
Then in your
local.xml
you can add your block to any exiting layout like this:And at last in your template at
base/default/templates/cms/cms-page-content.phtml
: