Magento – Empty page displaying in magento

layoutmagento-1.8php-5.4template

I am new to magento, I have created my custom module which is page. In page/html/header.phtml I add my custom content but it's displaying empty page. and I have set my package in system/configuration/design/package = easylife.

my code is

magento\app\etc\modules\Easylife_All.xml

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

and

magento\app\code\local\Easylife\Page\etc\config.xml

 <?xml version="1.0"?>
    <config>
        <modules>
            <Easylife_Page>
                <version>1.6.0.1</version>
            </Easylife_Page>
        </modules>
        <frontend>
            <layout>
                <updates>
                    <page>
                        <file before="Mage_Page">page.xml</file>
                    </page>
                </updates>
            </layout>
        </frontend>
        <stores>
            <admin>
                <design>
                    <theme>
                        <default>easylife</default>
                    </theme>
                </design>
            </admin>
        </stores>
    </config>

magento\app\design\frontend\easylife\default\layout\page.xml

<?xml version="1.0"?>
<layout version="0.1.0">

    <default translate="label" module="page">
        <label>All Pages</label>
            <block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
                <block type="page/html_head" name="head" as="head">

                    <!-- Custom COde -->
                    <action method="addItem"><type>skin_js</type><name>js/jquery.js</name><params/></action>
                    <action method="addItem"><type>skin_js</type><name>js/cf.js</name><params/></action>

                </block>
            </block>
    </default>

</layout>

magento\app\design\frontend\easylife\default\template\page\html\header.phtml

  <?php

    ?>
    <div class="header-container">
        <div class="header">
            <?php if ($this->getIsHomePage()):?>
                <h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>
            <?php else:?>
                <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>
            <?php endif?>
            <div class="quick-access">
                <?php echo $this->getChildHtml('topSearch') ?>
                <p class="welcome-msg"><?php echo $this->getChildHtml('welcome') ?> <?php echo $this->getAdditionalHtml() ?></p>
                <?php echo $this->getChildHtml('topLinks') ?>
                <!--?php Mage::log((array)$this->getChildHtml('topLinks')) ?-->
                <?php echo $this->getChildHtml('store_language') ?>
                <!-- Custom Code -->
                <?php echo $this->getChildHtml('cart_cartheader') ?>
            </div>
            <?php echo $this->getChildHtml('topContainer'); ?>
        </div>
    </div>
    <?php echo $this->getChildHtml('topMenu') ?>

I request //localhost/magento/index.php/ page but it's displaying empty page.

why it's displaying empty page?

Can anyone tell me where I went wrong?

Best Answer

I think that you are going about this the wrong way. From what I think your aim is:

  1. Add some custom js files,
  2. Change a single template slightly,

I would suggest just creating a local.xml file in your theme, rather than creating a complete theme an completely replacing the standard page.xml. The fact that you are replacing all the contents of the page.xml file is why you get a blank page.

If you create a local.xml that looks as follows:

<?xml version="1.0"?>
<layout>
    <default>
        <reference name="head">
            <action method="addItem">
                <type>skin_js</type>
                <name>js/jquery.js</name>
                <params/>
            </action>
            <action method="addItem">
                <type>skin_js</type>
                <name>js/cf.js</name>
                <params/>
            </action>
        </reference>
        <reference name="header">
            <action method="setTemplate">
                <template>path/to/your/new/header.phtml</template>
            </action>
        </reference>
    </default>
</layout>

Without creating a completely new theme when one is not needed.

Related Topic