Magento layout - content is not being rendered/displayed
Steps to Debug Layout Update XML issues:
Is your XML file (
local.xml
ormodule.xml
) being loaded into the systemDoes the handle tag you used in your layout file match a handle being generated for your request?
The quickest way to debug step 1 is, while in developer mode with errors showing, deliberately introduce a non-well-formed error to your Layout Update XML file.
<layout <!-- notice missing closing taglayout -->
<company_module_index_index>
<reference name="content">
<block type="module/ablock" name="myablock" template="module/ablock.phtml" />
</reference>
</company_module_index_index>
</layout>
If developer mode is on and you've cleared your cache, loading any page with the above in place will cause an error. This lets you know that Magento is trying to load your XML file. If the page loads without problem, that means you have your XML file in the wrong location, or you've misconfigured your XML in config.xml
.
Next up is your checking your layout handle. You'll want to make sure you're using the right one. You can view the layout handles that were used for a particular request by calling the following after your loadLayout
and renderLayout
request
//from a controller action
$this->loadLayout();
$this->renderLayout();
var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());
exit("bailing early at ".__LINE__." in ".__FILE__);
I've found the above items usually take care of 90% of layout problems. Be sure to go through the process a few times, as it's easy to miss one step and assume something's all right when it's not. Taking my usual risk of being a shill, part of why I created Commerce Bug (commercial debugging extension) was to provide this information quickly, and at a glance, to help with debugging problems.
Based on your comments below, the problem appears to be the layout handle you're using. The handle that's generated by the system is
module_module_test
However, the handle you're defining in your layout.xml is
company_module_index_index
This is the "full action name" handle. The typical syntax for this is
frontname_controllername_actionname
Change the handle to module_module_test
and you should be set.