0

What I am trying to do is to create a new template in my theme. I created a file in frontend/mytheme/default/template/page/2columns-left-cms.phtml. This is the content of it :

<!DOCTYPE html>
<html>
<head>
<?php echo $this->getChildHtml('head') ?> 
</head>
<body <?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>

    <?php echo $this->getChildHtml('after_body_start') ?>
    <?php echo $this->getChildHtml('header') ?>
    <div class="breadcrumbs-list">
        <?php echo $this->getChildHtml('breadcrumbs') ?> 
    </div>
    <div class="container product-details-container">
        <?php echo $this->getChildHtml('global_notices') ?>
        <div class="layout layout-1-col home-main">
            <div role="main" class="role-main">
                <?php echo $this->getChildHtml('global_messages') ?>
                <?php echo $this->getChildHtml('content') ?>
            </div>
        </div>
    </div>
    <?php echo $this->getChildHtml('footer') ?>
    <?php echo $this->getChildHtml('before_body_end') ?>
    <?php echo $this->getAbsoluteFooter() ?>

</body>
</html>

When I want to select from cms/design from layout, my new template, it doesn't show up. So what xml do i have to change ? what should i do ? Can someone explain the process?

Thank in Advance...

1

As it looks like you have FTP access. A quick extension would be..

create file under app/etc/modules/My_Othertemplates.xml with code

<?xml version="1.0"?>
<config>
 <modules>
  <My_Othertemplates>
  <codePool>community</codePool>
  <active>true</active>
  </My_Othertemplates>
 </modules>
</config>

..then create the Extension etc config file

app/code/community/My/Othertemplates/etc/config.xml

..with the code below

<?xml version="1.0"?>
 <config>
  <global>
   <page>
    <layouts>
     <!-- My New Template -->
     <page_2colleftcms>
     <label>2 Column Left CMS (2colleftcms)</label>
     <template>page/2columns-left-cms.phtml</template>
     <layout_handle>page_2colleftcms</layout_handle>
     </page_2colleftcms>
    </layouts>
   </page>
  </global>
 </config>

this new template should appear in the select template dropdown across the admin panel.

You can add more as well inside the app/code/community/My/Othertemplates/etc/config.xml. Just change "2colleftcms" to a unique name and make sure the template file exists in your theme folder or base folder

<!-- Another New Template -->
<page_2colleftcms>
<label>2 Column Left CMS (2colleftcms)</label>
<template>page/2columns-left-cms.phtml</template>
<layout_handle>page_2colleftcms</layout_handle>
</page_2colleftcms>

I'm using this with success

  • I created this module. I put exactly what you described, I cleared the cached, the module is enabled, but nothing appears in the cms page in the dropdown from the admin panel – Attila Naghi Aug 17 '15 at 7:24
  • Well i just did the steps above (on Magento 1.9.0.1) and its showing up on my cms page layout dropdown menu.. – BENN1TH Aug 17 '15 at 10:32
  • but where should i put the 2columns-left-cms.phtml ? i put it in mytheme/default/template/page – Attila Naghi Aug 17 '15 at 11:45
  • <template>page/2columns-left-cms.phtml</template> this points to the specified path given, so yes, just place the template file in the path specified. – BENN1TH Aug 18 '15 at 7:27
  • github.com/SeakEcommerce/AdditionalLayouts/blob/master/… - via GitHub repo – BENN1TH Sep 22 '15 at 21:15
-1
<custommodule_cms_index>
        <!— Custom page layout handles —>
        <reference name=“root”>
            <action method=“setTemplate”><template>page/2columns-left-cms.phtml</template></action>
             <!— Mark root page block that template is applied —>
             <action method=“setIsHandle”><applied>1</applied></action>
        </reference>
    </custommodule_cms_index>

or

<reference name="root">
    <action method="setTemplate"><template>page/2columns-left-cms.phtml</template></action>
</reference>

More view: Custom layout magento

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.