Friday, May 17, 2013

Magento:create new / Add New CMS Page Layout

Magento: Add New CMS Page Layout

Want to take your Magento Themes to the next level? Have multiple layouts? If you’re looking to add a new page layout in Magentocreate a custom layout or create a new theme layout then this solution is probably for you.
Add a new CMS Page Layout
First we have to create a module. Create file:app/etc/modules/Mage_Page.xml
<?xml version="1.0"?>
Then copy this whole folder: app/code/core/Mage/Page toapp/code/local/Mage
What we’ve done is taken a core module and copied it into our local module. This lets us override any core functionality without have to worry about it breaking in future update (or undoing if you mess up).
Now we need to edit: app/code/core/Mage/Page/etc/config.xml and look around line 46 and you can define your own layout, I’m going to call mine “home”
 <home module="page" translate="label">
    <empty module="page" translate="label">
    <one_column module="page" translate="label">
        <label>1 column</label>
    <two_columns_left module="page" translate="label">
        <label>2 columns with left bar</label>
    <two_columns_right module="page" translate="label">
        <label>2 columns with right bar</label>
    <three_columns module="page" translate="label">
        <label>3 columns</label>
Now all you have to do is make a template for this page. Navigate to your theme directory:app/design/frontend/YOUR_THEME/YOUR_THEME/template/page/ and create a new template called home.phtml. I suggest using another existing template as a starting point, such as 3columns.phtml so that you know what variables to work around. This will enable a custom layout option for CMS pages once you’re finished. I’ve tested this with 1.3 series but nothing previous or after that. If you have any comments or questions feel free to post them here or read the forum on Magento’s site for more details.

No comments:

Post a Comment