I have created a module with controller and model. But I am now trying to load a custom view where I can stuff all my PHP,css,js code into that PHTML file.
Here is my Block of Code
app\code\local\Soumen\Testmodule\controllers\IndexController.php
IndexController file
public function indexAction()
{
echo "This is default";
}
public function sayHelloAction()
{
Mage::log('im in Controller');
$this->loadLayout();
$this->renderLayout();
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
}
Config file
app\code\local\Soumen\Testmodule\etc\config.xml
<config>
<frontend>
<routers>
<Soumen_Testmodule>
<use>standard</use>
<args>
<module>Soumen_Testmodule</module>
<frontName>testmodule</frontName>
</args>
</Soumen_Testmodule>
</routers>
<layout>
<updates>
<testmodule>
<file>testmodule.xml</file>
</testmodule>
</updates>
</layout>
</frontend>
</config>
app\design\frontend\base\default\layout\testmodule.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<testmodule_index_index>
<reference name="content">
<block type="testmodule/test" name="test" template="testmodule/test.phtml" />
</reference>
</testmodule_index_index>
</layout>`
app\code\local\Soumen\Testmodule\Block\Test.php
class Soumen_Testmodule_Block_Test extends Mage_Core_Block_Template
{
public function getContent()
{
return "Hello World";
}
}
app\design\frontend\base\default\template\testmodule\test.phtml
<?php echo $this->getContent();?>
Now when I call http://magento/testmodule... Then it displays the dufault page, but should show Hello World . Can Someone help me out , that what wrong I am doing
testmodule.xml
from layout folder and block code