【发布时间】:2016-10-16 15:55:48
【问题描述】:
所以我对使用 Magento 还是很陌生,并且我在互联网上遵循了许多教程,但不知何故无法弄清楚为什么我的新管理面板页面无法加载。在这一点上,我只是想让页面重定向到 404 错误页面以外的任何地方。任何帮助将不胜感激!这是我所拥有的:
.../app/code/local/Name/Moudule/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Name_Module>
<version>0.1.0.0</version>
</Name_Module>
</modules>
<global>
<models>
<module>
<class>Name_Module_Model</class>
</module>
</models>
<helpers>
<name_module>
<class>Mage_Core_Helper</class>
</name_module>
</helpers>
...
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<module>Name_Module_index</module>
</modules>
</args>
</adminhtml>
</routers>
<layout>
<updates>
<module>
<file>module.xml</file>
</module>
</updates>
</layout>
</admin>
</config>
.../app/code/local/Name/Moudule/etc/adminhtml.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<menu>
<module module="name_module" translate="title">
<title>Test Tab</title>
<sort_order>100</sort_order>
<children>
<index module="name_module" translate="title">
<title>First Subtab</title>
<sort_order>1</sort_order>
<action>adminhtml/module</action>
</index>
</children>
</module>
</menu>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<module translate="title" module="name_module">
<title>Test Tab</title>
<sort_order>-100</sort_order>
<children>
<index translate="title">
<title>First Subtab</title>
<sort_order>1</sort_order>
</index>
</children>
</module>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
.../app/code/local/Name/Moudule/controllers/Adminhtml/CustomController.php
<?php
class Name_Module_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout()
->_setActiveMenu('module')
->_title($this->__('First Sub Tab'));
// my stuff
$this->renderLayout();
error_log("The function is being called somewhere",0); //not working
}
}
...\app\code\local\Name\Module\Helper\Data.php
<?php
class Name_Module_Helper_Data extends Mage_Core_Helper_Abstract
{
}
...\app\design\adminhtml\default\default\module\test.phtml
<?php echo "TEST";
error_log("The page is being called somewhere",0);
在这一切之后,我可以在管理面板中看到选项卡和子选项卡,但是如果单击“第一个子选项卡”,它会将我引导至“404 页面未找到”页面。任何帮助将不胜感激。
【问题讨论】:
-
哦,我建议您不要将自定义模块命名为 Name_Module。我希望它只是一个占位符 :) 你的模块肯定是有目的的,那么为什么不根据它的功能来命名呢?