1
這個問題是驅使我們堅果,已經幾個小時,沒有什麼,我試圖訪問第二個子菜單,關鍵詞一個404錯誤。我確定錯誤應該在控制器或佈局中,但是我不能找到它。我發佈我的配置,控制器和佈局文件。如果還需要更多,也可以添加它,但我認爲這些就足夠了。我使用AlanStorm的CommerceBug,並且塊和網格都正確加載。Magento adminhtml子菜單不工作
這裏是我不同的文件代碼:
config.xml中
<?xml version="1.0"?>
<config>
<modules>
<Dts_Allpages>
<version>0.1.0</version>
</Dts_Allpages>
</modules>
<global>
<models>
<allpages>
<class>Dts_Allpages_Model</class>
<resourceModel>allpages_resource</resourceModel>
</allpages>
<allpages_resource>
<class>Dts_Allpages_Model_Resource</class>
<entities>
<referencedpages>
<table>referencedpages</table>
</referencedpages>
<keywords>
<table>keywords</table>
</keywords>
</entities>
</allpages_resource>
</models>
<events>
<controller_action_predispatch>
<observers>
<controller_action_before>
<class>allpages/observer</class>
<method>saveReferrer</method>
</controller_action_before>
</observers>
</controller_action_predispatch>
</events>
<helpers>
<allpages>
<class>Dts_Allpages_Helper</class>
</allpages>
</helpers>
<resources>
<allpages_write>
<connection>
<use>core_write</use>
</connection>
</allpages_write>
<allpages_read>
<connection>
<use>core_read</use>
</connection>
</allpages_read>
</resources>
<blocks>
<allpages>
<class>Dts_Allpages_Block</class>
</allpages>
</blocks>
</global>
<admin>
<routers>
<allpages>
<use>admin</use>
<args>
<module>Dts_Allpages</module>
<frontName>allpages</frontName>
</args>
</allpages>
</routers>
</admin>
<adminhtml>
<menu>
<allpagesmainmenu translate="title" module="allpages">
<title>AllPages</title>
<sort_order>100</sort_order>
<children>
<allpages module="allpages">
<title>Keywords administration</title>
<sort_order>0</sort_order>
<children>
<references translate="title">
<title>References</title>
<sort_order>10</sort_order>
<action>allpages/adminhtml_allpagesbackend</action>
</references>
<keywords translate="title">
<title>Keywords</title>
<sort_order>20</sort_order>
<action>allpages/adminhtml_keywordsbackend</action>
</keywords>
</children>
</allpages>
</children>
</allpagesmainmenu>
</menu>
<acl>
<resources>
<admin>
<children>
<allpagesmainmenu translate="title" module="allpages">
<title>All Pages</title>
<children>
<allpages translate="title">
<title>Keywords administration</title>
<children>
<references translate="title">
<title>References</title>
<sort_order>10</sort_order>
</references>
<keywords translate="title">
<title>Keywords</title>
<sort_order>20</sort_order>
</keywords>
</children>
</allpages>
</children>
</allpagesmainmenu>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<allpages>
<file>allpages.xml</file>
</allpages>
</updates>
</layout>
</adminhtml>
</config>
KeywordsbackendController.php
<?php
class Dts_Allpages_Adminhtml_KeywordsbackendController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->_title($this->__("Administrador de keywords"));
$this->renderLayout();
}
}
佈局,allpages.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<allpages_adminhtml_allpagesbackend_index>
<reference name="content">
<block type="allpages/adminhtml_allpagesbackend" name="allpagesbackend"/>
</reference>
</allpages_adminhtml_allpagesbackend_index>
<allpages_adminhtml_allpagesbackend_edit>
<reference name="content">
<block type="allpages/adminhtml_allpagesbackend_edit" name="allpagesbackend_edit" />
</reference>
</allpages_adminhtml_allpagesbackend_edit>
<allpages_adminhtml_keywordsbackend_index>
<reference name="content">
<block type="allpages/adminhtml_keywordsbackend" name="keywordsbackend"/>
</reference>
</allpages_adminhtml_keywordsbackend_index>
<allpages_adminhtml_keywordsbackend_edit>
<reference name="content">
<block type="allpages/adminhtml_keywordsbackend_edit" name="keywordsbackend_edit" />
</reference>
</allpages_adminhtml_keywordsbackend_edit>
</layout>
參考下面的網址中的答案:http://stackoverflow.com/questions/12704729/magento-custom-module-with-custom-database-table-admin-page/12708001#12708001 –
你是什麼意思?現在我看到你的網址。沒有任何關係,我已經得到了一切工作,通過使用CommerceBug實例化塊,錯誤是因爲我說的不正確的文件名。 – Yaroslav