0

I followed this tutorial on making custom page layouts: http://inchoo.net/magento/custom-cms-page-layout/ I then set my home page to that template but I now get an error of

Fatal error: Call to a member function getChildHtml() on a non-object

but I'm not sure why though.. here's my code:

<?xml version="1.0"?>
<config>
    <global>
        <blocks>
            <custom>
                <class>Custom_CustomHomePage_Block</class>
            </custom>
        </blocks>
        <page>
            <layouts>
                <custom_home_page>
                    <label>Custom Home Page</label>
                    <template>page/customHomePage.phtml</template>
                </custom_home_page>
            </layouts>
        </page>
    </global>
</config>

this is the config.xml file found in /app/code/local/Custom/CustomHomePage/etc

and my Custom_CustomHomePage.xml file

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_CustomHomePage>
            <codePool>local</codePool>
            <active>true</active>
        </Custom_CustomHomePage>
    </modules>
</config>

this is found /app/etc/modules/

and my block class

<?php
    class Custom_CustomHomePage_Block extends Mage_Core_Block_Template {
    }
?>

found /app/code/local/Custom/CustomHomePage/Block

I can't for the life of me see what's wrong :(

Thanks in advance!

1 Answer 1

0
<?xml version="1.0"?>
<config>
  <modules>
    <Custom_CustomHomePage>
      <version>0.1.0</version>
    </Custom_CustomHomePage>
  </modules>
  <global>
    <blocks>
        <custom>
            <class>Custom_CustomHomePage_Block</class>
        </custom>
    </blocks>
    <page>
      <layouts>
        <custom_home_page translate="label">
          <label>Custom Home Page</label>
          <template>page/customHomePage.phtml</template>
        </custom_home_page>
      </layouts>
    </page>
  </global>
</config>

your Custom_CustomHomePage.xml file like below

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

add your page app/design/frontend/YOUR_INTERFACE/YOUR_THEME/template/page/customHomePage.phtml

4
  • unfortunately, it didn't work :(
    – 123TFO
    Oct 23, 2015 at 12:07
  • can you please post your template page code and error line no? Oct 23, 2015 at 12:16
  • My bad need to update the question, no longer fatal error (I solved it by doing a tweak to my block code) - it now returns an empty string :( haha solve one problem and faced with another
    – 123TFO
    Oct 23, 2015 at 12:21
  • Good you have mistake in your class name in block file <?php class Custom_CustomHomePage_Block extends Mage_Core_Block_Template Oct 23, 2015 at 12:23

Your Answer

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

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