Adding a new page layout in Magento is very simple. But why someone need to add a new page layout. Page layouts are already there.
Well, that can be needed specially for a Home page. One of my friend faced many issues in managing the Home page with existing layout. As a result, he needed to write other codes as well to maintain the concurrency between other pages. If we do change in current layout, it would affect the other pages as well using the same layout.
So better way it to create a new layout.
[The steps below are updated to make it work with Magento 1.4 as well]
Steps:
1. Open the file: app/etc/modules/Mage_All.xml
Edit the <codePool > tag to ‘local’ such that it looks like:
3 | <codepool>local</codepool> |
2. Copy config.xml
from app/code/core/Mage/Page/etc/config.xml
to app/code/local/Mage/Page/etc/config.xml
3. The file can be edited: app/code/local/Mage/Page/etc/config.xml
Add new lines between <layout> .. </layout> along with other layouts.
05 | <home module= "page" translate= "label" > |
07 | <template>page/home.phtml</template> |
08 | <layout_handle>page_home</layout_handle> |
2. Create new file : template/page/home.phtml along with 1column.phtml, 2columns-left.phtml etc.. You can just copy the existing code of one of the column layout phtml inside the home.phtml. Modify the code inside home.phtml as per your need.
3. On the Admin, Go To CMS -> Manage Pages. Edit the home page. Change the Layout to ‘Home’ under the ‘Design’ Tab.
This will apply the home.phtml to Home page.
No comments:
Post a Comment