12

I'd like to add a new page layout in Magento that will be an option that can be selected in CMS pages. I have copied the 1-column.phtml code and adapted it slightly and changed it to 1-column-version2.phtml.

I'd like to know please how I would go about referencing the new file so that it appears in the CMS page layout options.

.

Amit Bera
77.8k21 gold badges127 silver badges240 bronze badges
asked Oct 1, 2015 at 21:11

3 Answers 3

19

To meet your requirements you need to create an extension - without this it's not possible.

Module config file :

Create the module file config file at app/etc/modules/Amit_NewLayout.xml

Code:

<?xml version="1.0"?>
<config>
 <modules>
 <Amit_NewLayout>
 <active>true</active>
 <codePool>local</codePool>
 <depends>
 <Mage_Page />
 </depends>
 </Amit_NewLayout>
 </modules>
</config>

Define config.xml

Now define 1-column-version2.phtml as the template for the new layout in app/code/local/Amit/NewLayout/etc/config.xml

Code:

<?xml version="1.0"?> 
<config>
 <modules>
 <Amit_NewLayout>
 <version>0.0.1</version>
 </Amit_NewLayout>
 </modules>
 <global>
 <page>
 <layouts> 
 <new_cms_layout module="page" translate="label">
 <label>New Cms Layout</label>
 <template>page/1-column-version2.phtml</template>
 <layout_handle>lookbook</layout_handle>
 </new_cms_layout> 
 </layouts>
 </page>
 </global>
</config>

Now, you will be able to see this layout in the CMS page layout options.

answered Oct 1, 2015 at 21:26
1
  • Without this post, it's not possible. Commented Oct 17, 2016 at 15:44
1

Create one module and add below xml in your config.xml file.

app/code/local/Namespace/CustomLayouts/etc/config.xml
<?xml version="1.0"?>
<config>
 <global>
 <page>
 <layouts>
 <custom_static_page_one>
 <label>Custom static page</label>
 <template>page/1-column-version2.phtml</template>
 </custom_static_page_one>
 </layouts>
 </page>
 </global>
</config>

Register your module

app/etc/modules/Namespace_CustomLayouts.xml
<?xml version="1.0"?>
<config>
 <modules>
 <Namespace_CustomLayouts>
 <codePool>local</codePool>
 <active>true</active>
 </Namespace_CustomLayouts>
 </modules>
</config>

Create your own template file page/1-column-version2.phtml

answered Oct 1, 2015 at 21:22
-3

Add Your code in

app\code\core\Mage\Page\etc

config.xml:

with

 <My_one_column_cms module="page" translate="label">
 <label>My One Column</label>
 <template>page/home.phtml</template>
 <layout_handle>My_one_column_cms</layout_handle>
 </My_one_column_cms>

You can change names as ur wish in xml in u can put any words

Then create home.phtml as your template in newtheme/newpack/page/ or ur default theme

answered Sep 27, 2017 at 10:01
2
  • Unwise to modify the core files. Commented Dec 21, 2017 at 16:22
  • You should never directly change the Core files. To elaborate, if you were to upgrade your Magento instance you would lose your changes. This is why you would create your own extension and implement like in Amit Bera's answer Commented Jan 30, 2018 at 14:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.