在 Magento 的管理模块中显示模板
Display template in Admin Module of Magento
我是 Magento 新手。我正在尝试为 Magento 管理面板开发一个自定义模块。我的代码如下
位置: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
logo.php
<?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/etc
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/etc
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>
位置:app/design/adminhtml/default/default/template
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
品牌logo.php
<?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
品牌标识控制器
<?php
class Digitab_Brandlogo_Adminhtml_BrandlogoController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
位置:app/code/local/Digitab/Brandlogo/etc
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/etc
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>
位置:app/design/adminhtml/default/default/template
test.phtml
ABCD
但它不起作用。现在我可以在管理面板中看到一个空白的白页。谢谢
这里有很多错误,我将逐步查看每个文件。
Digitab_Brandlogo.xml
一切都很好。
logo.php
这里唯一的错误是您的文件名与您的 class 名称不同(徽标 != 滑块)。只需将文件名更改为 class 名称,反之亦然,您应该会很好地处理此文件。另外,将 class 和文件名的首字母大写。
IndexController.php
此处与 logo.php 相同,您对文件的命名与 class 不同,但是您希望将文件名更改为 class 名称您已经在很多其他文件中使用过它。文件名应为 BrandlogoController.php
config.xml
因为你定义了一个块,所以你想在全局下定义你的块。
替换
<blocks />
有了这个:
<blocks>
<digitab_brandlogo>
<class>Digitab_Brandlogo_Block</class>
</digitab_brandlogo>
</blocks>
然后,在你的路由器下,你要确保 Brandlogo 是大写的,如下所示:
<digitab_brandlogo>
<use>admin</use>
<args>
<module>Digitab_Brandlogo</module>
<frontName>brandlogo</frontName>
</args>
</digitab_brandlogo>
adminhtml.xml
你的动作就是你想在你的控制器中击中的东西。此设置(在管理控制器上)是 adminhtml/module_controller_action(如果您关闭操作,它默认为索引),因此在这种情况下您希望它是这样的:
<action>adminhtml/brandlogo_brandlogo</action>
Data.php
一切都很好。
brandlogo.xml
您的标签需要采用 adminhtml_module_controller_action 格式,所以让我们将其更改为以下格式:
<adminhtml_brandlogo_brandlogo_index>
然后在这一行:
<block type="brandlogo/adminhtml_brandlogo" name="brandlogo" template="test.phtml"/>
您正在尝试使用虚构的块类型。还记得之前我们将块命名为 Logo 或 Slider 吗?这在这里发挥作用,因为那应该是您用于 "type" 的文件路径。所以它应该看起来像以下之一:
如果你选择了Slider
<block type="brandlogo/adminhtml_slider" name="brandlogo" template="test.phtml"/>
如果你选择了标志
<block type="brandlogo/adminhtml_logo" name="brandlogo" template="test.phtml"/>
test.phtml
一切都很好。
希望对您有所帮助!
这是一个完整的答案:
地点:app/etc/modules
Digitab_Brandlogo.xml
看起来不错。
位置:app/code/local/Digitab/Brandlogo/Block/Adminhtml
此文件夹需要包含以下文件和文件夹:
app/code/local/Digitab/Brandlogo/Block/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));
}
}
app/code/local/Digitab/Brandlogo/Block/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
1. app/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>
2。 app/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
看起来不错。
我已经在我的本地机器上检查了这段代码。在此处找到屏幕截图:
让我知道这是否适合你。
注意 :: 请遵循我的回答中提到的确切命名约定和文件夹名称以及代码
快乐编码...
我是 Magento 新手。我正在尝试为 Magento 管理面板开发一个自定义模块。我的代码如下
位置: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
logo.php
<?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/etc
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/etc
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>
位置:app/design/adminhtml/default/default/template
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
品牌logo.php
<?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
品牌标识控制器
<?php
class Digitab_Brandlogo_Adminhtml_BrandlogoController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
位置:app/code/local/Digitab/Brandlogo/etc
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/etc
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>
位置:app/design/adminhtml/default/default/template
test.phtml
ABCD
但它不起作用。现在我可以在管理面板中看到一个空白的白页。谢谢
这里有很多错误,我将逐步查看每个文件。
Digitab_Brandlogo.xml
一切都很好。
logo.php
这里唯一的错误是您的文件名与您的 class 名称不同(徽标 != 滑块)。只需将文件名更改为 class 名称,反之亦然,您应该会很好地处理此文件。另外,将 class 和文件名的首字母大写。
IndexController.php
此处与 logo.php 相同,您对文件的命名与 class 不同,但是您希望将文件名更改为 class 名称您已经在很多其他文件中使用过它。文件名应为 BrandlogoController.php
config.xml
因为你定义了一个块,所以你想在全局下定义你的块。
替换
<blocks />
有了这个:
<blocks>
<digitab_brandlogo>
<class>Digitab_Brandlogo_Block</class>
</digitab_brandlogo>
</blocks>
然后,在你的路由器下,你要确保 Brandlogo 是大写的,如下所示:
<digitab_brandlogo>
<use>admin</use>
<args>
<module>Digitab_Brandlogo</module>
<frontName>brandlogo</frontName>
</args>
</digitab_brandlogo>
adminhtml.xml
你的动作就是你想在你的控制器中击中的东西。此设置(在管理控制器上)是 adminhtml/module_controller_action(如果您关闭操作,它默认为索引),因此在这种情况下您希望它是这样的:
<action>adminhtml/brandlogo_brandlogo</action>
Data.php
一切都很好。
brandlogo.xml
您的标签需要采用 adminhtml_module_controller_action 格式,所以让我们将其更改为以下格式:
<adminhtml_brandlogo_brandlogo_index>
然后在这一行:
<block type="brandlogo/adminhtml_brandlogo" name="brandlogo" template="test.phtml"/>
您正在尝试使用虚构的块类型。还记得之前我们将块命名为 Logo 或 Slider 吗?这在这里发挥作用,因为那应该是您用于 "type" 的文件路径。所以它应该看起来像以下之一:
如果你选择了Slider
<block type="brandlogo/adminhtml_slider" name="brandlogo" template="test.phtml"/>
如果你选择了标志
<block type="brandlogo/adminhtml_logo" name="brandlogo" template="test.phtml"/>
test.phtml
一切都很好。
希望对您有所帮助!
这是一个完整的答案:
地点:app/etc/modules
Digitab_Brandlogo.xml
看起来不错。
位置:app/code/local/Digitab/Brandlogo/Block/Adminhtml
此文件夹需要包含以下文件和文件夹:
app/code/local/Digitab/Brandlogo/Block/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));
}
}
app/code/local/Digitab/Brandlogo/Block/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
1. app/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>
2。 app/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
看起来不错。
我已经在我的本地机器上检查了这段代码。在此处找到屏幕截图:
让我知道这是否适合你。
注意 :: 请遵循我的回答中提到的确切命名约定和文件夹名称以及代码
快乐编码...