1

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?

2

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.

1

I think you have some error on the page. Go to index.php and uncomment ini_set('display_errors', 1);. Also go to magento/var/log/ and check log files.

  • @Oleksiisvarychevskyi, I uncommented ini_set('display_errors', 1); this and magento/var/log/system.log file there is no errors I got. what happend can you suggest me? my code is correct or not? – Magento Nav Feb 13 '14 at 9:17
  • Can you give me a example of code for override Page module from custom package? – Magento Nav Feb 13 '14 at 9:28
1

It's probably a name conflict between Mage_Page and your Easylife_Page. Both use Page as a module name which will lead to issues.

From what I can see you're trying to add some CSS and some edits to header.phtml which can be done without an extension.

In your package/templates layout directory create a local.xml and add the following

<?xml version="1.0"?>
<layout version="0.1.0">
    <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>
   </default>
</layout>

and in the template directory add the file page/html/header.phtml with your custom html code.

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.