簡體   English   中英

magento自定義管理模塊無法加載phtml布局文件

[英]magento custom admin module can't load the phtml layout file

我正在嘗試創建自定義管理模塊,但未加載phtml文件,這是代碼

Controller.php這樣

<?php 
class TempName_AdminLog_Adminhtml_AdminLogController extends Mage_Adminhtml_Controller_Action
{

    public function indexAction()
    {
            //$this->loadLayout()->_setActiveMenu('AdminLog/items');
            $this->loadLayout();
            $this->renderLayout();

            var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());
die();

            //echo "abc";
    }   

}

adminhtml.xml

<?xml version="1.0"?>
<config>
    <menu>
        <adminlog module="adminlog"  translate="title"> 
            <title>Admin Log</title>
            <sort_order>72</sort_order>     
            <children>
                <adminlog module="adminlog"  translate="title"> 


                            <title>Manage</title>
                            <sort_order>450</sort_order>
                            <action>adminlog/adminhtml_adminlog</action>

                </adminlog>
            </children>
        </adminlog>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <adminlog module="adminlog" >
                        <title>adminlog</title>
                        <sort_order>200</sort_order>
                    </adminlog>
                </children>
            </admin>
        </resources>
    </acl>  
    <layout>
        <updates>
            <adminlog>
                <file>adminlog.xml</file>
            </adminlog>
        </updates>
    </layout>
</config>

adminlog.xml

<?xml version="1.0"?>
<layout>
    <adminlog_adminhtml_adminlog_index>
        <update handle="adminlog_adminlog_index"/>
        <reference name="content">
            <block type="adminhtml/template" name="adminlog" template="adminlog/adminlog.phtml"/>
        </reference>
    </adminlog_adminhtml_adminlog_index>
</layout>

config.xml中

<?xml version="1.0"?>

<config>
    <modules>
        <TempName_AdminLog>
            <version>1.0.0</version>
            <title>Admin log module</title>
        </TempName_AdminLog>
    </modules>
    <global>

        <helpers>
            <adminlog>
                <class>TempName_AdminLog_Helper</class>
            </adminlog>
        </helpers>
        <default>
            <adminlog>
                <general>
                    <enable>1</enable>
                </general>
            </adminlog>
        </default>

    </global>
    <admin>
        <routers>
            <adminlog>
                <use>admin</use>
                <args>
                    <module>TempName_AdminLog</module>
                    <frontName>adminlog</frontName>
                </args>
            </adminlog>
        </routers>
    </admin>
    <layout>
        <updates>
            <adminlog>
                <file>adminlog.xml</file>
            </adminlog>
        </updates>
    </layout>
</config>

任何人都可以找出問題所在嗎? 謝謝

您的config.xml在哪里?

您需要在<adminhtml>選項卡中的config.xml添加布局文件。

像這樣

  <adminhtml>
    <layout>
      <updates>
        <demo>
          <file>demo.xml</file>
        </demo>
      </updates>
    </layout>
  </adminhtml>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM