cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner - Layout does not work / load

Beginner - Layout does not work / load

Hello, im a complete beginner in Magento 1.x and used this tutorial to create my first layout:

http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-4.html
 
Recently i completed it till the point "The Layout" and have done everything exactly as described. But it only loads the default layout with no content in it.

My Controller:
app/code/local/Magentotutorial/Helloworld/controllers/IndexController.php

<?php

class Magentotutorial_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {        
    
    public function indexAction() {
        $this->loadLayout();
        $this->renderLayout();
    }

    public function goodbyeAction() {
        echo 'Goodbye World!';
    }
    
    public function paramsAction() {
        echo ' ';            
        foreach($this->getRequest()->getParams() as $key=>$value) {
            echo 'Param: '.$key.' | ';
            echo 'Value: '.$value.'<br/>';
        }
        echo ' ';
    }
    
}

 

 

My config.xml:
app/code/local/Magentotutorial/Helloworld/etc/config.xml

<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>

 

 

My file to activate the module:
app/etc/modules/Magentotutorial_Helloworld.xml

<config>
    <modules>
        <Magentotutorial_Helloworld>
            <active>true</active>
            <codePool>local</codePool>
        </Magentotutorial_Helloworld>
    </modules>
</config>

 

My layout file:
app/design/frontend/base/default/layout/local.xml

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

 

My template file:
app/design/frontend/base/default/template/magentotutorial/helloworld/simple_page.phtml

<!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>

 
If i write something in the indexAction function like this, it works and displays the text.

public function indexAction() {
     echo "Hello World";
    }

But if i try to load the template i created like this, it always loads the default layout with no contend at all.

public function indexAction() {
        $this->loadLayout();
        $this->renderLayout();
    }


Is there something wrong or missing? I searched for several hours now and could not find anything wrong, compared to the tutorial example.