做一个在后台显示的内容的简单模块

来源:互联网 发布:godaddy域名续费贵啊 编辑:程序博客网 时间:2024/04/29 22:24


在menu做好的基础上!!!!

1
app/etc/modules

2
app/code/community/AQ/Gao/etc/config.xml
<?xml version="1.0"?>
<config>
    <modules>
        <AQ_Gao>
            <version>0.1.21</version>

        </AQ_Gao>
    </modules>
   


    <frontend>
        <routers>
            <gao>
                <use>standard</use>
                <args>
                    <module>AQ_Gao</module>
                    <frontName>gao</frontName>
                </args>
            </gao>
        </routers>
    </frontend>

    <admin>
        <routers>
            <gao_admin>
                <use>admin</use>
                <args>
                    <module>AQ_Gao</module>
                    <frontName>gao_admin</frontName>
                </args>   
            </gao_admin>
        </routers>
    </admin>

    <adminhtml>
       
        <layout>
            <updates>
                <gao>
                    <file>aq_gao.xml</file>
                </gao>
            </updates>
        </layout>
       </adminhtml>  



    <global>
       
         <helpers>
                <gao>
                    <class>AQ_Gao_Helper</class>
                </gao>
                </helpers>
        <blocks>
            <gao>
                <class>AQ_Gao_Block</class>
            </gao>
        </blocks>
    </global>

</config>


在此文件中,blocks,helps,adminhtml(xml文件),admin--routers都是必须要有的。

3
app/code/community/AQ/Gao/etc/adminhtml.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <menu>
        <gao module="gao">
           
            <title>TerryTest11</title>
        <sort_order>51</sort_order>
        <children>
            <aa module="gao">
                <title>Bao</title>
                <sort_order>0</sort_order>
                <action>gao_admin/index/bao</action>
            </aa>
            <posts module="gao">
                <title>Kun</title>
                <sort_order>1</sort_order>
                <action>gao_admin/index/kun</action>
            </posts>
        </children>
        </gao>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <gao>
                       
                    <title>TerryTest11</title>
                    <sort_order>51</sort_order>
                        <children>
                        <aa>
                        <title>Bao</title>
                        <sort_order>0</sort_order>
                       
                        </aa>
                        <posts>
                        <title>Kun</title>
                        <sort_order>1</sort_order>
                       
                        </posts>
                        </children>
           
                    </gao>
                   
                </children>
            </admin>
        </resources>
    </acl>
    <layout>
        <updates>
            <gao>
                <file>aq_gao.xml</file>
            </gao>
        </updates>
    </layout>
</config>


配置好!























4

app/design/adminhtml/default/default/layout/aq_gao.xml

<?xml version="1.0" ?>
<layout version="0.1.0">
    <default>
        <reference name="head">
        </reference>
       
    </default>
    <gao_admin_index_bao>
         <update handle="editor" />
        <reference name="content">
            <block type="core/template" name="index" template="gao/terry.phtml" />
        </reference>
    </gao_admin_index_bao>
</layout>

5
app/design/adminhtml/default/default/template/gao/terry.phtml

<div>
good.very good!
</div>   


进入后台访问,可以看到内容部分显示出来“good.very good!”,OK!

原创粉丝点击