位置:app / etc / modules
Digitab_Brandlogo.xml
<?xml version="1.0" encoding="utf-8"?> <config> <modules> <Digitab_Brandlogo> <active>true</active> <codePool>local</codePool> </Digitab_Brandlogo> </modules> </config>
位置:app / code / local / Digitab / Brandlogo / Block / Adminhtml
<?PHP class Digitab_Brandlogo_Block_Adminhtml_slider extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { $this->_controller = 'adminhtml_brandlogo'; $this->_blockGroup = 'brandlogo'; $this->_headerText = Mage::helper('brandlogo')->__('Brand logo Manager'); $this->_addButtonLabel = Mage::helper('brandlogo')->__('Add Brand'); parent::__construct(); } }
位置:app / code / local / Digitab / Brandlogo / controllers / Adminhtml
IndexController.PHP
<?PHP class Digitab_Brandlogo_Adminhtml_BrandlogoController extends Mage_Adminhtml_Controller_Action { public function indexAction() { $this->loadLayout(); $this->renderLayout(); } }
位置:app / code / local / Digitab / Brandlogo等
config.xml中
<?xml version="1.0"?> <config> <modules> <digitab_brandlogo> <version>1.0.0</version> </digitab_brandlogo> </modules> <global> <models /> <blocks /> <resources /> <extraconfig /> <helpers> <digitab_brandlogo> <class>Digitab_Brandlogo_Helper</class> </digitab_brandlogo> </helpers> </global> <admin> <routers> <digitab_brandlogo> <use>admin</use> <args> <module>Digitab_brandlogo</module> <frontName>brandlogo</frontName> </args> </digitab_brandlogo> </routers> </admin> <adminhtml> <layout> <updates> <brandlogo> <file>brandlogo.xml</file> </brandlogo> </updates> </layout> </adminhtml> </config>
位置:app / code / local / Digitab / Brandlogo等
adminhtml.xml
<?xml version="1.0"?> <config> <menu> <digitab translate="title" module="digitab_brandlogo"> <title>Digitab</title> <sort_order>110</sort_order> <children> <brandlogo> <title>Brand logo</title> <sort_order>1</sort_order> <action>brandlogo/adminhtml_brandlogo</action> </brandlogo> </children> </digitab> </menu> </config>
位置:app / code / local / Digitab / Brandlogo / Helper
Data.PHP
<?PHP class Digitab_Brandlogo_Helper_Data extends Mage_Core_Helper_Abstract { }
位置:app / design / adminhtml / default / default / layout
brandlogo.xml
<?xml version="1.0"?> <layout version="0.1.0"> <brandlogo_adminhtml_brandlogo_index> <reference name="content"> <block type="brandlogo/adminhtml_brandlogo" name="brandlogo" template="test.phtml"/> </reference> </brandlogo_adminhtml_brandlogo_index> </layout>
位置:应用程序/设计/ adminhtml /默认/缺省/模板
test.phtml
ABCD
我得到如下输出
如何显示模板?有人可以帮我吗谢谢
更新
位置:app / etc / modules
Digitab_Brandlogo.xml
<?xml version="1.0" encoding="utf-8"?> <config> <modules> <Digitab_Brandlogo> <active>true</active> <codePool>local</codePool> </Digitab_Brandlogo> </modules> </config>
位置:app / code / local / Digitab / Brandlogo / Block / Adminhtml
<?PHP class Digitab_Brandlogo_Block_Adminhtml_Brandlogo extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { $this->_controller = 'adminhtml_brandlogo'; $this->_blockGroup = 'brandlogo'; $this->_headerText = Mage::helper('brandlogo')->__('Brand logo Manager'); $this->_addButtonLabel = Mage::helper('brandlogo')->__('Add Brand'); parent::__construct(); } }
位置:app / code / local / Digitab / Brandlogo / controllers / Adminhtml
BrandlogoController
<?PHP class Digitab_Brandlogo_Adminhtml_BrandlogoController extends Mage_Adminhtml_Controller_Action { public function indexAction() { $this->loadLayout(); $this->renderLayout(); } }
位置:app / code / local / Digitab / Brandlogo等
config.xml中
<?xml version="1.0"?> <config> <modules> <digitab_brandlogo> <version>1.0.0</version> </digitab_brandlogo> </modules> <global> <models /> <blocks> <brandlogo> <class>Digitab_Brandlogo_Block</class> </brandlogo> </blocks> <resources /> <extraconfig /> <helpers> <digitab_brandlogo> <class>Digitab_Brandlogo_Helper</class> </digitab_brandlogo> </helpers> </global> <admin> <routers> <digitab_brandlogo> <use>admin</use> <args> <module>Digitab_brandlogo</module> <frontName>brandlogo</frontName> </args> </digitab_brandlogo> </routers> </admin> <adminhtml> <layout> <updates> <brandlogo> <file>brandlogo.xml</file> </brandlogo> </updates> </layout> </adminhtml> </config>
位置:app / code / local / Digitab / Brandlogo等
adminhtml.xml
<?xml version="1.0"?> <config> <menu> <digitab translate="title" module="digitab_brandlogo"> <title>Digitab</title> <sort_order>110</sort_order> <children> <brandlogo> <title>Brand logo</title> <sort_order>1</sort_order> <action>brandlogo/adminhtml_brandlogo</action> </brandlogo> </children> </digitab> </menu> </config>
位置:app / code / local / Digitab / Brandlogo / Helper
Data.PHP
<?PHP class Digitab_Brandlogo_Helper_Data extends Mage_Core_Helper_Abstract { }
位置:app / design / adminhtml / default / default / layout
brandlogo.xml
<?xml version="1.0"?> <layout version="0.1.0"> <brandlogo_adminhtml_brandlogo_index> <reference name="content"> <block type="brandlogo/adminhtml_brandlogo" name="brandlogo" template="test.phtml"/> </reference> </brandlogo_adminhtml_brandlogo_index> </layout>
位置:应用程序/设计/ adminhtml /默认/缺省/模板
test.phtml
ABCD
但它不工作.现在我可以在管理面板中看到一个空白的白页.谢谢
位置:app / etc / modules
Digitab_Brandlogo.xml
看起来不错.
位置:app / code / local / Digitab / Brandlogo / Block / Adminhtml
应用程序/代码/本地/ Digitab / Brandlogo /砌块/ Adminhtml / Brandlogo / Grid.PHP
<?PHP class Digitab_Brandlogo_Block_Adminhtml_Brandlogo_Grid extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setId('digitab_brandlogo_grid'); $this->setDefaultSort('increment_id'); $this->setDefaultDir('DESC'); $this->setSaveParametersInSession(true); $this->setUseAjax(true); } public function getGridUrl() { return $this->getUrl('*/*/grid',array('_current'=>true)); } }
应用程序/代码/本地/ Digitab / Brandlogo /座/ Adminhtml / Brandlogo.PHP
<?PHP class Digitab_Brandlogo_Block_Adminhtml_Brandlogo extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { $this->_blockGroup = 'digitab_brandlogo'; $this->_controller = 'adminhtml_brandlogo'; $this->_headerText = Mage::helper('digitab_brandlogo')->__('Brand logo Manager'); parent::__construct(); $this->_addButtonLabel = Mage::helper('digitab_brandlogo')->__('Add Brand'); } }
位置:app / code / local / Digitab / Brandlogo / Helper / Data.PHP
<?PHP class Digitab_Brandlogo_Helper_Data extends Mage_Core_Helper_Abstract {}
位置:app / code / local / Digitab / Brandlogo / controllers / Adminhtml / BrandlogoController.PHP
<?PHP class Digitab_Brandlogo_Adminhtml_BrandlogoController extends Mage_Adminhtml_Controller_Action { public function indexAction() { $this->loadLayout(); $this->renderLayout(); } }
The main problem is with the way you have written the XML files.
位置:app / code / local / Digitab / Brandlogo / etc
etc / code / local / Digitab / Brandlogo / etc / config.xml下面是config.xml的代码必须如何.
<?xml version="1.0"?> <config> <modules> <Digitab_Brandlogo> <version>1.0.0</version> </Digitab_Brandlogo> </modules> <global> <models /> <blocks> <digitab_brandlogo> <class>Digitab_Brandlogo_Block</class> </digitab_brandlogo> </blocks> <resources /> <extraconfig /> <helpers> <digitab_brandlogo> <class>Digitab_Brandlogo_Helper</class> </digitab_brandlogo> </helpers> </global> <admin> <routers> <adminhtml> <args> <modules> <digitab_brandlogo before="Mage_Adminhtml">Digitab_Brandlogo_Adminhtml</digitab_brandlogo> </modules> </args> </adminhtml> </routers> </admin> <adminhtml> <layout> <updates> <brandlogo> <file>brandlogo.xml</file> </brandlogo> </updates> </layout> </adminhtml> </config>
etc / code / local / Digitab / Brandlogo / etc / adminhtml.xml下面是config.xml的代码必须如何.
<?xml version="1.0"?> <config> <menu> <digitab translate="title" module="digitab_brandlogo"> <title>Digitab</title> <sort_order>110</sort_order> <children> <brandlogo> <title>Brand logo</title> <sort_order>1</sort_order> <action>adminhtml/brandlogo/index</action> </brandlogo> </children> </digitab> </menu> </config>
位置:app / design / frontend / adminhtml / default / default / layout / brandlogo.xml
<?xml version="1.0"?> <layout version="0.1.0"> <adminhtml_brandlogo_index> <reference name="content"> <block type="digitab_brandlogo/adminhtml_brandlogo" name="brandlogo" template="test.phtml"/> </reference> </adminhtml_brandlogo_index> </layout>
位置:app / design / frontend / adminhtml / default / default / template / test.phtml
看起来不错
我在本地机器上检查过这个代码.在此找到屏幕截图:
让我知道,如果这适用于你.
注意::遵循“我的答案”中明确的“公约”和“文件名称”及其代码
快乐编码…