magento - How to add IndexController in admin -


<?php class main_contacts_adminhellocontroller extends mage_adminhtml_controller_action {     public function indexaction()     {          $this->loadlayout();      //create text block name of "example-block"         $block = $this->getlayout()         ->createblock('core/text', 'example-block')         ->settext('<h1>this text block</h1>');          $this->_addcontent($block);          $this->_setactivemenu('main')->renderlayout();             } } 

if wrote code okay, when use setformaction instead of createblock causes error , want use method in admin section.

indexcontroller.php

public function indexaction()     {         $this->loadlayout();         $this->getlayout()->getblock('contactform')             ->setformaction( mage::geturl('*/*/post') );          $this->_initlayoutmessages('customer/session');         $this->_initlayoutmessages('catalog/session');         $this->renderlayout();     } 

how can use code please tell me.

you can use way think way know class magento_simplecontact_indexcontroller extends mage_adminhtml_controller_action

public function indexaction() { $this->loadlayout();     $block = $this->getlayout()->createblock(         'mage_core_block_template',         'magento.simple_contact',         array(             'template' => 'magento/simple_contact.phtml'         )     );     $this->getlayout()->getblock('content')->append($block);     //$this->getlayout()->getblock('right')->insert($block, 'catalog.compare.sidebar', true);     $this->_initlayoutmessages('core/session');     $this->renderlayout();** 

in contact file app/design/frontend/default/default/template/magento/simple_contact.phtml


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -