title: Configuring Magento Layout for New Admin Module
body: <p>I'm trying to create a custom report in the Magento back-end; my strategy is to first make my new module mimic the existing Reports/Sales/Orders functionality in the admin panel, and then make the required changes once I've seen how the pieces fit together. I've added my new menu item, and the module loads the basic admin layout and some breadcrumbs, so the module config and controller config are set up properly enough. However, layout blocks aren't loading. Here's the problem code. Assume that I have a copy of the relevant block file at app/code/local/BULX/Reports/Block/Report/Sales/Sales/Grid.php:</p>
  
  <pre><code>class BULX_Reports_IndexController extends Mage_Adminhtml_Report_SalesController { 
  
    public function salesAction {
  
    //...otherwise identical to parent class
  
    //should load reference to Grid block
    $gridBlock = $this-&gt;getLayout()-&gt;getBlock('report_sales_sales.grid');
  
    /* in original Mage module, will output Mage_Adminhtml_Block_Report_Sales_Sales_Grid
       in BULX_Report, outputs nothing. */
    echo get_class($gridBlock)."&lt;br&gt;";
  </code></pre>
  
  <p>My config file has </p>
  
  <pre><code>&lt;global&gt;
    &lt;blocks&gt;
      &lt;bulx_reports&gt;
        &lt;class&gt;BULX_Reports_Block&lt;/class&gt;
      &lt;/bulx_reports&gt;
    &lt;/blocks&gt;
    ...
  &lt;/global&gt;
  </code></pre>
  
  <p>If I change the code to</p>
  
  <pre><code>$gridBlock = $this-&gt;getLayout()-&gt;getBlock('bulx_reports/test');
  </code></pre>
  
  <p>with the following file at app/code/local/BULX/Reports/Block/Test.php</p>
  
  <pre><code>class BULX_Reports_Block_Test extends Mage_Core_Block_Abstract
  {
   protected function _toHtml() {
    echo 'to html';
   }
  }
  </code></pre>
  
  <p>I get the same result: no 'to html' output, no output from the get_class call</p>
  
  <p>I added log statements as suggested here:
  <a href="http://www.fontis.com.au/blog/magento/magento-debugging-loading-blocks-layouts-and-config-files" rel="nofollow">http://www.fontis.com.au/blog/magento/magento-debugging-loading-blocks-layouts-and-config-files</a></p>
  
  <p>and it's clear from that Magento isn't finding any layout blocks in my new module. Alan Storm's tutorials are usually incredibly helpful, but I'm not finding what I need in alanstorm.com/magento_admin_controllers (sorry not enough reputation to have two hyperlinks); as far as I can tell, I've set up my configuration identically. A difficulty is that the 'report_sales_sales.grid' string doesn't appear anywhere-those Grids appear in lots of places in the admin, and they get built dynamically by a structure that I haven't found.</p>
  
  <p>What am I missing? This is Enterprise Edition, 1.8. Thanks!</p>