0
config.xml :

<config>
        <modules>
            <Ndot_Helloworld>
                <version>0.1.0</version>
            </Ndot_Helloworld>
        </modules>
        <global>    
            <blocks>
                <helloworld>
                    <class>Ndot_Helloworld_Block</class>
                </helloworld>
            </blocks>

        </global>
        <frontend>
            <routers>
                <helloworld>
                    <use>standard</use>
                    <args>
                        <module>Ndot_Helloworld</module>
                        <frontName>helloworld</frontName>
                    </args>
                </helloworld>
            </routers>
            <layout>
                <updates>
                    <helloworld module="helloworld">
                        <file>ndot/helloworld.xml</file>
                    </helloworld>
                </updates>
            </layout>
        </frontend>
<config>

helloworld.xml
--------------
<layout version="1.0">
    <helloworld_index_index>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action> 
        </reference>
        <reference name="content">
            <block type="ndot/helloworld" name="helloworld.custom" template="ndot/helloworld/helloworld.phtml">
            </block>
        </reference>
    </helloworld_index_index>
</layout>

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

Helloworld.php
-------------
class Ndot_Helloworld_Block_Helloworld extends Mage_Core_Block_Template {

    public function myMessage() {
        echo '=================='; exit;
        return 'I am Iyngaran, This is my module.';
    }

}

When i call the myMessage() from the helloworld.phtml but the result is not showing.

0

You have wrongly specify the block type in your file, Call like below

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

In the above code block type is like follow

first: helloworld >> the name you have define in the etc/config.xml file

i.e:

<global>    
   <blocks>
       <helloworld> <!-- Your module block name -->
           <class>Ndot_Helloworld_Block</class>
       </helloworld>
   </blocks>    
</global>

Second(after '/') : Your block file name.

  • i try with your way, but its again no response. can you please share some other answer. – senthil Apr 6 '15 at 4:10
  • Could you show your helloworld.phtml – MeenakshiSundaram R Apr 6 '15 at 4:18
  • echo $this->myMessage() this single line only in my helloworld.phtml file, its placed in "magento/app/design/frontend/ndot/english/template/helloworld" – senthil Apr 6 '15 at 4:20
  • Ok.did your layout root template change? – MeenakshiSundaram R Apr 6 '15 at 4:33
  • Enable the path hint and check your file rendered or not. – MeenakshiSundaram R Apr 6 '15 at 4:41

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.