
Making a page in Magento packed full of your lovely SEO keyword driven content is easy, really easy. But what happens when you want to get that content somewhere that isn’t one of those pages? That’s when everything falls apart…
Let’s get this straight from the get go- Magento is not a content management system and at this point it’s not really trying to be one… well, maybe just a little. It’s got pages, templates and static blocks which can be embedded within each other. Confused? I’d suggest taking a look at the Design Terminologies page. With these 3 main tools and some imagination you can do quite a bit in terms of ensuring that content on a site is editable via the cms.
Unfortunately other than a brief front-end overview, Magento’s developer documentation is non-existent. Luckily there’s a pretty good community of developers willing to share what they’ve learned. Throughout my adventures with Magento I’ve kept a running list of different ways you can grab content from somewhere else, here’s some of the most commonly used ones.
Embed a Static Block Within a Page
So you’ve got a static block of content that you want to put inside of a page, cool. Just drop this snippet in the page’s content textarea and the static block with and id of "foo-block" will magically appear.
{{block type="cms/block" block_id="foo-block"}}
Get a Static Block’s Content From Within a Template File
This does the same thing as above except instead of being used in a page, it’s used in a template file.
$this->getLayout()->createBlock('cms/block')->setBlockId('foo-block')->toHtml();
Inserting a Template file Inside of a Page’s Content
You’ll notice the curly braces, that means it’s a CMS tag like our first example. Just two things have changed, The type of block is different and in the template attribute you specify the path relative to your templates folder.
{{block type="core/template" template="path-to-template.phtml"}}
Templates in Templates
You’re in a template file and you want to include another template file in it, chances are you should probably be using Magento’s block layout system for this rather than manually including it the template. Regardless of best practices, here’s how it’s done.
$this->getLayout()->createBlock('Mage_Adminhtml_Block_Template', 'block-name')->setData('template', 'path-to-your-file.phtml')->toHtml();
Here is a great resource that dives deeper into various CMS syntax tags Magento CMS syntax – part1








