I have created easylife admincontroller and it configure the config.xml, and I give the Url-> protocal://Ipaddress/ics/admin/admintest but it's not displaying.
can any one tell me where I went wrong?
my code is:
Ics->EasyLife->controllers->Adminhtml->IndexController.php
<?php
class Ics_EasyLife_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
Ics->EasyLife->Block->Adminhtml->Template.php
<?php
class Ics_EasyLife_Block_Adminhtml_Template extends Mage_Adminhtml_Block_Widget_Form
{
public function MyMethod()
{
echo "Admin Html Page Method";
}
}
Ics->EasyLife->etc->config.xml
<admin>
<routers>
<icscontroller>
<use>admin</use>
<args>
<module>Ics_EasyLife</module>
<frontName>admintest</frontName>
</args>
</icscontroller>
</routers>
</admin>
thanks in advance.
Best Answer
I don't like that method of providing your own
frontName
, I prefer to overload the existing admin router because it's neat and quick. Start by changing this in your config.xml:This will make magento check for controller classes that start with
Ics_EasyLife_Adminhtml
before checking it's ownMage_Adminhtml
. Rename your controller toIcs_EasyLife_Adminhtml_EasylifeController
and rename it's corresponding file toEasylifeController.php
.Now an URL of
adminhtml/easylife
will expand tohttp://ipaddress/ics/admin/easylife/index
and call yourindexAction
method. When making a menu entry use that URL ofadminhtml/easylife
. Even if you don't have any layout or blocks in place yet at least a page will show. When writing a layout use the layout handle<adminhtml_easylife_index>
.