【问题标题】:magento load phtml in adminmagento 在管理员中加载 phtml
【发布时间】:2015-01-17 20:42:32
【问题描述】:

首先对不起我的英语真的很糟糕。

我正在尝试学习 magento。 问题是在管理面板中加载 PHTML 文件。 在菜单中,链接没问题,但我加载了一个空白页面。 BLOK 没问题,因为如果我加载字体就可以了。

这是我的文件:

/app/code/local/Package/HelloWorld/etc/config.xml

  <admin>
        <routers>
            <helloworld><!-- nome modulo -->
                <use>admin</use>
                <args>
                    <module>Package_HelloWorld</module> <!-- namespace -->
                    <frontName>admintest</frontName><!-- path-->
                </args>
            </helloworld>
        </routers>
    </admin>
    <adminhtml>
        <layout>
            <updates>
                <helloworld>
                    <file>helloworld.xml</file><!-- file di layout, ricordiamoci che sta in /app/design/adminhtml/default/-->
                </helloworld>
            </updates>
        </layout>
        <menu><!-- aggiungo al menu del pannello-->
            <helloworld translate="title" module="adminhtml">
                <title>The Nano </title>
                <sort_order>100</sort_order>
                <children>
                    <set_time>
                        <title>Leggo da db</title>
                        <action>admintest/adminhtml_index</action>
                    </set_time>
                </children>
            </helloworld>
        </menu>
    </adminhtml>

/app/design/adminhtml/default/Package/layout/helloworl.xml

<layout version="0.1.0">
    <helloworld_adminhtml_index_index>
        <default name="content">
            <block type="nomeblocco/nomebloccointerno" name="helloworld_scheda"    template="helloworld/scheda.phtml"/>
        </default>
    </helloworld_adminhtml_index_index>
</layout>

PHTML 没问题,是:

/app/design/adminhtml/default/Package/template/helloworl/scheda.phtml

【问题讨论】:

    标签: php magento


    【解决方案1】:

    您在此处缺少参考

    <layout version="0.1.0">
        <helloworld_adminhtml_index_index>
            <reference name="content">
                <block type="nomeblocco/nomebloccointerno" name="helloworld_scheda"    template="helloworld/scheda.phtml"/>
            </reference>
        </helloworld_adminhtml_index_index>
        </layout>
    

    【讨论】:

    • 太棒了!我在 /adminhtml/default/default 中添加了参考 TAG 和 mouve 布局和模板,现在它可以工作了!谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多