I am not so familer with magento so i am trying to develop a simple module on magento 1.9.1 with help of this tutorial http://magentotutorial.net/magento-tutorial-how-to-create-a-simple-module/
but i am facing a problem with display the text in frontend with layout & templates(phtml file)
if i write simple
echo "hello";
in
indexAction() of IndexController.php
it display simple hello text on blank screen without any magento template on url sitename.com/hello
but if write
$this->loadLayout();
$this->renderLayout();
it display my theme layout with any content in content area
here is my codes
app/code/etc/modules/Dinesh_hello.xml
<?xml version="1.0"?>
<config>
<modules>
<Dinesh_Hello>
<active>true</active>
<codePool>local</codePool>
</Dinesh_Hello>
</modules>
</config>
app/code/local/Dinesh/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Dinesh_Hello>
<version>0.1.0</version>
</Dinesh_Hello>
</modules>
<global>
</global>
<frontend>
<routers>
<dinesh_hello>
<use>standard</use>
<args>
<module>Dinesh_Hello</module>
<frontName>hello</frontName>
</args>
</dinesh_hello>
</routers>
<layout>
<updates>
<hello>
<file>hello.xml</file>
</hello>
</updates>
</layout>
</frontend>
<global>
<blocks>
<hello>
<class>Dinesh_Hello_Block</class>
</hello>
</blocks>
</global>
</config>
app/code/local/Dinesh/controllers/IndexController.php
<?php
class Dinesh_Hello_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
//echo "hello";
}
}
?>
app/code/local/Dinesh/Block/Hello.php
<?php
class Dinesh_Hello_Block_Hello extends Mage_Core_Block_Template
{
public function methodblock()
{
return ‘informations about my block !!’ ;
}
}
?>
app/design/frontend/default/default/layout/hello.xml
<layout version=”0.1.0″>
<hello_index_index>
<reference name=”root”>
<action method=”setTemplate”><template>page/1column.phtml</template></action>
</reference>
<reference name=”content”>
<block type=”hello/hello” name=”hello” template=”hello/hello.phtml”/>
</reference>
</hello_index_index>
</layout>
app/design/frontend/default/default/template/hello/hello.phtml
<?php
echo $this->methodblock();
//echo "hello";
?>