Magento adminhtml layout update

user3858520 picture user3858520 · Jul 20, 2014 · Viewed 9.2k times · Source

I'm trying to get a layout in my admin page.

If i do a var_dump in my controller (Highor_Plugin_StatisticsController), than i see the dump.

This is what i have so far:

app/code/local/Highor/Plugin/etc/config.xml

  <?xml version="1.0"?>
<config>
    <modules>
        <highor_plugin>
            <version>1.0.0</version>
            <depends>
                <!-- no dependencies -->
            </depends>
        </highor_plugin>
    </modules>
    <global>
        <models />
        <blocks />
        <resources />
        <extraconfig />
        <helpers>
            <highorplugin>
                <class>Highor_Plugin_Helper</class>
            </highorplugin>
        </helpers>
    </global>
    <admin>
        <routers>
            <highorplugin>
                <use>admin</use>
                <args>
                    <module>Highor_Plugin</module>
                    <frontName>highorplugin</frontName>
                </args>
            </highorplugin>
        </routers>
    </admin>
    <adminhtml>
        <layout>
            <updates>
                <highor_plugin>
                    <file>highorplugin.xml</file>
                </highor_plugin>
            </updates>
        </layout>
    </adminhtml>
</config>

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

<?xml version="1.0"?>
<layout>
    <highorplugin_statistics_index>
        <reference name="content">
            <block type="core/template" name="highor" template="highor/plugin.phtml" />
        </reference>
    </highorplugin_statistics_index>
</layout>

app/design/frontend/base/default/template/highor/plugin.phtml

Some text...

Answer

Adelmar picture Adelmar · Jul 21, 2014

Your layout update is for the adminhtml area, so Magento is searching for the corresponding template in the adminhtml package/theme, but your template is in the frontend area so it isn't finding anything.

The rest of your syntax all looks fine, so just move this file:

app/design/frontend/base/default/template/highor/plugin.phtml

to this location:

app/design/adminhtml/default/default/template/highor/plugin.phtml

and it should work fine.