Adding a Custom Block to Magento CMS Page

Adding a Custom Block to Magento CMS Page

Adding a custom block to Magento CMS page is a very good way to improve the flexibility of these static pages. This will help us to keep our CMS page tight, without copy-pasting the same large paragraph of scripts into every single page.

It’s usually an over-shoot to build a whole new module for this, a new block class would be sufficient for this purpose.
Since it’s CMS related, we can simply do the following:

  • Extend the Magento core module: core/Mage/CMS
  • Create local/Mage/Cms/Block/xxx.php
  • Also create the corresponding .phtml template
  • (No update needed for the layout/ folder)

More