0
votes

Creating a simple hello wold in Magento and need some help. I can get "Hello World" to show up just fine on a white screen with my IndexController, but whenever I try to use the default theme, I get nothing.

My files are as follows local

New
  Helloworld
    Block
      Helloworld.php
    controllers
      IndexControllers.php
    etc
      config.xml

App
  design
    frontend
      default
        layout
          helloworld.xml
        template
          helloworld
            helloworld.phtml

Here's my config

    <?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <New_Helloworld>
            <version>0.0.1</version>
        </New_Helloworld>
    </modules>
    <frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>New_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
        <layout>
            <updates>
                <helloworld>
                      <file>helloworld.xml</file>
                </helloworld>
            </updates>
        </layout>  
    </frontend>
    <global>
        <blocks>
            <helloworld>
                <rewrite>
                     <helloworld>New_Helloworld_Block_Helloworld</helloworld>
                </rewrite>
            </helloworld>
         </blocks>
    </global>
</config>

Here's my helloworld.xml

<?xml version="1.0"?>

    <layout version="0.1.0">

        <helloworld_index_index>
            <reference name="root">
                <action method="setTemplate"><template>page/1column.phtml</template></action>
            </reference>
            <reference name="content">
                <block type="helloworld/helloworld" name="hello" template="helloworld/helloworld.phtml"/>
            </reference>
        </helloworld_index_index>

    </layout>

I have a simple echo hello world in design/default/default/template/helloworld/helloworld.phtml

My IndexController file is as follows

<?php
class New_Helloworld_IndexController extends Mage_Core_Controller_Front_Action
{
     public function indexAction()
     {
         $this->loadLayout();
         $this->renderLayout();
     }
}
2
I think you missed to active you module. Create a xml file in app/etc/module/ named as New_Helloworld.xml - urfusion
Sorry, forgot to add that part. I already have that active. - user3277150
what url you hitting for checking your module working - urfusion

2 Answers

0
votes

I think you missed to active you module. Create a xml file in app/etc/module/ named as New_Helloworld.xml

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

Update

Replace

<rewrite>
   <helloworld>New_Helloworld_Block_Helloworld</helloworld>
</rewrite>

to

 <helloworld>
    <class>New_Helloworld_Block</class>
 </helloworld>

in config.xml and

replace

    <reference name="content">
        <block type="helloworld/helloworld" name="hello" template="helloworld/helloworld.phtml"/>
    </reference>

to

<reference name="content">   
  <block type="helloworld/index" name="helloworld_index" template="helloworld/index.phtml"/>   
</reference> 

this might help you.

0
votes

Figured out what I was doing wrong... I was in frontend/default but when I put my .phtml in fronterwd