1

I was working on a large module and I couldn't get an adminhtml layout XML file to load. So I created a new test module to isolate the issue and I still can't get the layout file to load.

I don't think my layout file is loading because if I turn on developer mode and mess up my config.xml or my adminhtml.xml then I get errors. But if I mess up the XML in my layout file then there are no errors.

Here's my config.xml:

#File: app/code/local/TestBlue/MeLayout/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <TestBlue_MeLayout>
            <version>1.0.0</version>
        </TestBlue_MeLayout>
    </modules>

    <admin>
        <routers>
            <testblue_melayout>
                <use>admin</use>
                <args>
                    <module>TestBlue_MeLayout</module>
                    <frontName>me-layout</frontName>
                </args>
            </testblue_melayout>
        </routers>
    </admin>

    <adminhtml>
        <layout>
            <updates>
                <testblue_melayout>
                    <file>testblue_melayout.xml</file>
                </testblue_melayout>
            </updates>
        </layout>
    </adminhtml>
</config>

Here's my adminhtml.xml:

#File: app/code/local/TestBlue/MeLayout/etc/adminhtml.xml

<?xml version="1.0"?>
<config>
    <menu>
        <sales>
            <children>
                <testblue_melayout>
                    <title>Me Layout</title>
                    <sort_order>1000</sort_order>
                    <action>me-layout/adminhtml_index/index</action>
                </testblue_melayout>
            </children>
        </sales>
    </menu>
</config>

Here's my controller:

#File: app/code/local/TestBlue/MeLayout/controllers/Adminhtml/IndexController.php

<?php

class TestBlue_MeLayout_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }
}

And here's the layout file that I don't think loads:

#File: app/design/frontend/mytheme/default/layout/testblue_melayout.xml

<?xml version="1.0"?>
<layout version="1.0.0">
    <default>
        <reference name="before_body_end">
            <block type="core/template" template="file.phtml"/>
        </reference>
    </default>
</layout>

Everything here works properly except I don't think that layout file at the bottom of my config.xml loads. In other words, if I click the new admin menu item under sales then I properly hit that indexAction() in the controller. But of course that page is blank and I want to put content there by using a layout file so that I can specify a .phtml file for that route but again I don't think the layout file is loading.

The layout file code that I put above is a copy of another layout file in the same directory that is currently successfully loading for a different module on the frontend(ie. the public facing site).

So how can I troubleshoot why this layout file isn't loading?

All I really want to do is put some content on this new admin route page. If I can't figure out this layout file loading issue, then what are some other options for displaying content on the page? Can I assign HTML to the layout right inside indexAction()?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.