0

I want to attach my template and block to custom module but how to manage it? I want to just print simple hello there with proper layout in admin panel these are my files.

app\code\local\Matrid\Feedmanager\etc\config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Matrid_Feedmanager>
      <version>0.1.0</version>
    </Matrid_Feedmanager>
  </modules>
  <frontend>
    <routers>
      <feedmanager>
        <use>standard</use>
        <args>
          <module>Matrid_Feedmanager</module>
          <frontName>feedmanager</frontName>
        </args>
      </feedmanager>
    </routers>
  </frontend>
<admin>
  <routers>
    <feedmanager>
     <use>admin</use>
     <args>
      <module>Matrid_Feedmanager</module>
      <frontName>admin_feedmanager</frontName>
     </args>
    </feedmanager>
  </routers>
</admin>
<global>
  <helpers>
    <feedmanager>
      <class>Matrid_Feedmanager_Helper</class>
    </feedmanager>
  </helpers>
</global>
<adminhtml>
 <layout>
        <updates>
      <matrid>
          <file>feedmanager.xml</file>
         </matrid>
     </updates>   
    </layout>
 <menu>
 <catalog>
 <children>
   <feedmanager module="feedmanager">
     <title>Matrid_Feedmanager</title>
     <sort_order>31</sort_order>
    <children>
      <feedmanager module="feedmanager">
        <title>Manager_Items</title>
        <sort_order>2</sort_order>
        <action>admin_feedmanager/adminhtml_index</action>
      </feedmanager>
    </children>
   </feedmanager>
   </children>
   </catalog>
 </menu>
</adminhtml>
</config>

app\code\local\Matrid\Feedmanager\controller\adminhtml\IndexController.php

 <?php

    class Matrid_Feedmanager_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action {
     protected function _isAllowed()
        {
            return true;
        }

      public function indexAction() {

            $this->loadLayout();
            $this->renderLayout();


      }

    }

app\code\local\Matrid\Feedmanager\controller\IndexController.php

class Matrid_Feedmanager_IndexController extends Mage_Core_Controller_Front_Action{

    public function indexAction()
    {
        $this->loadLayout ();
        $this->renderLayout ();
    }
    public function anotherAction()
    {
        echo 'test mamethode';
    }
}

app/design/frontend/default/electronics/layout/feedmanager.xml

<layout version="0.1.0">
    <default>
        <reference name="content">
        </reference>
    </default>
    <test_index_index>
        <reference name="content">
            <block type="feedmanager/mydata" name="feed_mydata" template="feedmanager/index.phtml" />
        </reference>
    </feedmanager_index_index>
</layout>
  • 1
    You have placed your layout xml file in the frontend and there are few coding issues in your layout xml file. – Priyank Mar 16 '18 at 6:51
  • i got it bro thanx for help its working now – Sohan Singh Mar 16 '18 at 8:14
  • I want to add more children under module like one manage item and other data items so what steps should i follow from beginning to add it?? – Sohan Singh Mar 16 '18 at 8:46
1

For Backend Module You can try keeping this files

app/code/local/Matrid/Feedmanager/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Matrid_Feedmanager>
            <version>0.1.0</version>
        </Matrid_Feedmanager>
    </modules>
    <global>
        <helpers>
            <feedmanager>
                <class>Matrid_Feedmanager_Helper</class>
            </feedmanager>
        </helpers>
        <blocks>
            <feedmanager>
                <class>Matrid_Feedmanager_Block</class>
            </feedmanager>
        </blocks>
    </global>
    <admin>
        <routers>
            <feedmanager>
                <use>admin</use>
                <args>
                    <module>Matrid_Feedmanager</module>
                    <frontName>admin_feedmanager</frontName>
                </args>
            </feedmanager>
        </routers>
    </admin>
    <adminhtml>
        <menu>
            <feedmanager module="feedmanager">
                <title>Feedmanager</title>
                <sort_order>100</sort_order>
                <children>
                    <feedmanagerbackend module="feedmanager">
                        <title>Backend Page Title</title>
                        <sort_order>0</sort_order>
                        <action>admin_feedmanager/adminhtml_feedmanagerbackend</action>
                    </feedmanagerbackend>
                </children>
            </feedmanager>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <feedmanager translate="title" module="feedmanager">
                            <title>Feedmanager</title>
                            <sort_order>1000</sort_order>
                            <children>
                                <feedmanagerbackend translate="title">
                                    <title>Backend Page Title</title>
                                </feedmanagerbackend>
                            </children>
                        </feedmanager>
                    </children>
                </admin>
            </resources>
        </acl>
        <layout>
            <updates>
                <feedmanager>
                    <file>feedmanager.xml</file>
                </feedmanager>
            </updates>
        </layout>
    </adminhtml>
</config>

app/code/local/Matrid/Feedmanager/Helper/Data.php

<?php
class Matrid_Feedmanager_Helper_Data extends Mage_Core_Helper_Abstract {

}

app/code/local/Matrid/Feedmanager/controllers/Adminhtml/FeedmanagerbackendController.php

<?php

class Matrid_Feedmanager_Adminhtml_FeedmanagerbackendController extends Mage_Adminhtml_Controller_Action {

    protected function _isAllowed() {
        //return Mage::getSingleton('admin/session')->isAllowed('feedmanager/feedmanagerbackend');
        return true;
    }

    public function indexAction() {
        $this->loadLayout();
        $this->_title($this->__("Backend Page Title"));
        $this->renderLayout();
    }

}

app/design/adminhtml/default/default/layout/feedmanager.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <feedmanager_adminhtml_feedmanagerbackend_index>
        <reference name="content">
            <block type="feedmanager/adminhtml_feedmanagerbackend" name="feedmanagerbackend" template="feedmanager/feedmanagerbackend.phtml"/>
        </reference>
    </feedmanager_adminhtml_feedmanagerbackend_index>
</layout>

app/design/adminhtml/default/default/template/feedmanager/feedmanagerbackend.phtml

Simple add hello as content

app/code/local/Matrid/Feedmanager/Block/Adminhtml/Feedmanagerbackend.php

<?php

class Matrid_Feedmanager_Block_Adminhtml_Feedmanagerbackend extends Mage_Adminhtml_Block_Template {

}

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.