A very common issue, but can't get my head around this one. Just not able to load the custom layout I want to display under the Admin tab content of my custom module via XML layout file (something like the attached image). This works while I add the same from controller's action.
I am currently doing the same under the controller action like this (working) -
public function indexAction() {
$this->loadLayout()
->_setActiveMenu('module')
->_title($this->__('Module'));
$this->_addContent($this->getLayout()->createBlock('adminhtml/template')->setTemplate('sync/index.phtml'));
$this->renderLayout();
//$this->getLayout()->setBlock('module_sync/');
}
Configured config.xml, app/design/adminhtml/default/default/layout/sync.xml (as mentioned in config.xml), and template file (as mentioned in layout file) - app/design/adminhtml/default/default/template/sync/index.phtml
The handlers seems to be fine, as checked by the code below, under the action:
$this->getLayout()->getUpdate()->getHandles()
As per the log of loaded files the mgt-commerce debugging module, the layout xml (module_sync.xml) is being parsed. Therefore, I am assuming things go haywire after that.
The configuration files:
<?xml version="1.0"?>
<config>
<modules>
<Module_Sync>
<version>1.0.0</version>
</Module_Sync>
</modules>
<global>
<models>
<!--
Model alias referred to in install-1.0.0.php.
-->
<module_sync>
<class>Module_Sync_Model</class>
<resourceModel>module_sync_resource</resourceModel>
</module_sync>
<!--
This alias must match the above <resourceModel/> value.
-->
<module_sync_resource>
<class>Module_Sync_Model_Resource</class>
<entities>
<!--
Table alias referred to in install-0.0.1.php.
-->
<config>
<!--
Actual name of the database table.
-->
<table>module_config</table>
</config>
<queue>
<!--
Actual name of the database table.
-->
<table>module_queue</table>
</queue>
</entities>
</module_sync_resource>
</models>
<resources>
<!--
This must match our folder name in the module sql folder.
-->
<module_sync_setup>
<setup>
<!--
This defines which module the setup
scripts in this location belong to.
-->
<module>Module_Sync</module>
<!--
In each setup script, this
value determines the class of $this.
-->
<class>Mage_Core_Model_Resource_Setup</class>
</setup>
</module_sync_setup>
<module_sync_read>
<connection>
<use>core_read</use>
</connection>
</module_sync_read>
<module_sync_write>
<connection>
<use>core_write</use>
</connection>
</module_sync_write>
</resources>
<helpers>
<module_sync>
<class>Module_Sync_Helper</class>
</module_sync>
</helpers>
<blocks>
<sync>
<class>Module_Sync_Block_Index</class>
</sync>
</blocks>
</global>
<admin>
<routers>
<adminhtml>
<use>admin</use>
<args>
<modules>
<module_sync before="Mage_Adminhtml">Module_Sync_Adminhtml</module_sync>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<module_sync>
<file>module_sync.xml</file>
</module_sync>
</updates>
</layout>
</adminhtml>
<default>
<api>
<cp>
<url>dev.module.com/api</url>
<routes>
<user>users</user>
</routes>
</cp>
<ms>
<url>162.13.184.69/api/v2</url>
<routes>
<category>categories</category>
</routes>
</ms>
</api>
</default>
</config>
- Layout file - app/design/adminhtml/default/default/module_sync.xml
<?xml version="1.0"?>
<layout>
<module_sync_index>
<reference name="head">
<action method="setTitle" translate="title">
<title>Module</title>
</action>
</reference>
<reference name="content">
<block type="module_sync/adminhtml_index" template="sync/index.phtml"/>
</reference>
</module_sync_index>
</layout>
Template file (app/design/adminhtml/default/default/template/sync/index.phtml)
<div class="content"> <h3 class="mobi-text">Module Signup</h3> <form> <div> <input type="text" name="name" placeholder="Enter your Name"> </div> <div> <input type="text" name="email" placeholder="Enter your Email"> </div> <div> <input type="text" name="url" placeholder="Enter Store URL"> </div> <div> <input type="text" name="no" placeholder="Enter your phone number"> </div> <div> <input type="submit" class="btn btn-red btn-lg" value="Sign Up"> </div> <div> <p>Already have an account? <a href="">Sign In</a></p> </div> </form> </div>
Already read and tried these
Admin layout file not loading in custom module
custom module layout not working
and some more.