I am writing a custom module for magento and having some problems here. My layout xml does not work. even i am not getting any exception or log. I have also try it after cache flushing and re-indexing through admin panel. hello message is printed which is put under IndexController.php but layout doesnot load.
The layout xml file is put under
/var/www/magento/app/design/frontend/default/default/layout/wsplugin.xml
config.xml
<?xml version="1.0"?>
<config>
<modules>
<NAMESPACE_WSPlugin>
<version>0.1.0</version>
<depends>
<Mage_Catalog />
</depends>
</NAMESPACE_WSPlugin>
</modules>
<frontend>
<routers>
<wsplugin>
<use>standard</use>
<args>
<module>NAMESPACE_WSPlugin</module>
<frontName>wsplugin</frontName>
</args>
</wsplugin>
</routers>
<layout>
<updates>
<wsplugin>
<file>wsplugin.xml</file>
</wsplugin>
</updates>
</layout>
</frontend>
<global>
<blocks>
<wsplugin>
<class>NAMESPACE_WSPlugin_Block</class>
</wsplugin>
</blocks>
<helpers>
<wsplugin>
<class>NAMESPACE_WSPlugin_Helper</class>
</wsplugin>
</helpers>
</global>
</config>
IndexController.php
<?php
class NAMESPACE_WSPlugin_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
$this->loadLayout();
$this->renderLayout();
echo 'hello message';
}
}
?>
WSPlugin.php(Under NAMESPACE/WSPlugin/Block)
<?php
class NAMESPACE_WSPlugin_Block_WSPlugin extends Mage_Core_Block_Template {
public function getWSPlugin() {
return "get WS Plugin under Block";
}
}
wsplugin.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="content">
</reference>
</default>
<wsplugin_index_index>
<reference name="content">
<block type="wsplugin/wsplugin" name="wsplugin" template="wsplugin/wsplugin.phtml" />
</reference>
</wsplugin_index_index>
</layout>
wsplugin.phtml
<h4><?php echo 'Welcome in WS Plugin';
echo $this->getWSPlugin();
?></h4>