11

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.

.

17

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.

  • Without this post, it's not possible. – jmargolisvt Oct 17 '16 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

-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

  • Unwise to modify the core files. – KiwisTasteGood Dec 21 '17 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 – JoshCarter Jan 30 '18 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.