I'm trying to load in a block on one of my admin pages in a custom module, but it doesn't appear to be loading. At first I thought it was a handle issue, but I've found out that the handle is adminhtml_bar_index
through the controller. I know it's not loading because I have debug mode on, and, when I break the XML, no error whatsoever gets thrown or logged. What else could be wrong?
/app/code/local/Foo/Bar/etc/config.xml
<?xml version="1.0"?>
<config>
<!-- ... -->
<adminhtml>
<layout>
<updates>
<bar>
<file>foo_bar.xml</file>
</bar>
</updates>
</layout>
<!-- ... -->
</adminhtml>
<!-- ... -->
</config>
/app/design/adminhtml/default/default/layout/foo_bar.xml
<?xml version="1.0"?>
<layout>
<adminhtml_bar_index>
<reference name="content">
<block type="foo_bar/adminhtml_profiles_grid" />
<reference>
</adminhtml_bar_index>
</layout>
Thanks in advance!
Edit: I've managed to make it load. I don't know how, but I did. I think it was a handle issue still.
Best Answer
Here are some sanity checks for when, like now, there are no error messages to go on.
Are all files readable by the web server/PHP?
I have a quick publishing script which recursively forces some file permissions. The only argument it needs is the folder to check.
Is the module definitely loaded?
At the very least it should be listed in System > Configuration > Advanced > Disable Modules Output. For a more thorough debugging see Alan Storm's Module List Module.
Disable all caching whenever developing.
If the old config.xml content is being used then Magento cannot be aware of new instructions to load layout files. Ditto for changes to cached layouts.
For the handle
adminhtml_bar_index
the responsible action is probably in the fileapp/code/local/Foo/Bar/controllers/BarController.php
and looks like this:To check execution is getting this far put a
die(__METHOD__)
call in that function and refresh the page. Seeing the method name is definitive proof.In your
config.xml
you correctly have this:Think what would happen if
<bar>
was also used by another module? One of the two modules would have it's contribution overruled. Try changing the name of that node to anything else.