1

I'm having trouble getting my page to render properly.

At app/design/frontend/base/default/layout, I have the following local.xml file ...

<layout version="0.1.0">
    <helloworld_index_index>
        <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" />
    </helloworld_index_index>
</layout>

At app/design/frontend/base/default/template/magentotutorial/helloworld I have the following in my simple_page.phtml file ...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Hello, World!</title>
        <style type="text/css">
body {
    background-color: #f00;
    }
        </style>
    </head>
    <body>

    </body>
</html>

At app/code/local/Magentotutorial/Helloworld/controllers I have the following in my IndexController.php file ...

<?php

    class Magentotutorial_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {

        public function indexAction () {

            $this->loadLayout ();

            $this->renderLayout ();

        }

    }

?>

And lastly (not sure if it matters) at app/code/local/Magentotutorial/Helloworld/etc, my config.xml has the following ...

<config>
    <modules>
        <Magentotutorial_Helloworld>
            <version>0.1.0</version>
        </Magentotutorial_Helloworld>
    </modules>
    <frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Magentotutorial_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
</config>

According to the tutorial I'm following, this is supposed to create a blank page with a red background, and a page title of Hello, World! when I navigate to http://<mysite>/helloworld/index/index.

However, it does not.

My module is registered in my Magento installation, and I have made sure to clear both the Configuration and Layout caches after each respective upload.

What I get instead of what I am expecting is the normal site, minus any page-specific content. The page title is simply Magento Commerce.

My version of Magento is 1.7.0.2, and I have been following along with this tutorial (I know it's old, but it worked well up until this section).

Can anybody point me in the right direction to figure out what I am doing wrong?

1

Edit

The first answer below is actually incorrect, it does fallback. It works the other way against you - you can't have two local.xml files.

So you would need to check if you already have a local.xml file that is being loaded instead of yours. Locations to check are

app/design/frontend/PACKAGE/THEME/layout/local.xml app/design/frontend/PACKAGE/default/layout/local.xml

Original answer

The local.xml in a theme does not have a fallback mechanism so it will only be loaded from your currently active package/theme.

A default Magento install will have the package/theme default/default. I would suggest trying to place the file into

app/design/frontend/default/default/layout
  • That did not work. But then again I don't have a default installation. I inherited a fully developed installation from an outside shop. I'm still new to Magento, so where would I find out which theme is currently being used? – Clayton Roth Dec 11 '13 at 8:14
  • In the back-end you can view your current theme settings under System > Configuration > Design – Kristof at Fooman Dec 11 '13 at 8:36
  • Package > Current Package Name and Theme > Default would make up your file location app/design/frontend/PACKAGE/THEME/layout – Kristof at Fooman Dec 11 '13 at 8:37

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.