title: Magento: Custom left tab menu in module
body: <p>I have figured out how to add the actual tab items to my custom module, however I cannot figure out how to add the green looking section titles like the System module has. it isnt hard to add your own to the system module itself by using the system.xml file, but how does one add one to their own module menu?!</p>
  
  <p>edit: added the code I use for the tabs as reference. The documentation for the block being extended also posted below.
  <a href="http://docs.magentocommerce.com/Mage_Adminhtml/Mage_Adminhtml_Block_Widget_Tabs.html" rel="nofollow">http://docs.magentocommerce.com/Mage_Adminhtml/Mage_Adminhtml_Block_Widget_Tabs.html</a></p>
  
  <p>This is to add tabs, but what about their section titles??</p>
  
  <pre><code>    $this-&gt;addTab('custom_assigned_tab1_id_name', array(
          'label'     =&gt; Mage::helper('coffefreakhelper1')-&gt;__('Custom tab1 here'),
          'title'     =&gt; Mage::helper('coffefreakhelper1')-&gt;__('My custom tab1 title here'),
          'content'   =&gt; 'Some content here. We could add direct string here, or we can use something like $this-&gt;getLayout()-&gt;createBlock("adminhtml/cms_page_edit_tab_main")-&gt;toHtml()',
          'active'    =&gt; true
      ));
  </code></pre>
  
  <p>EDIT: Solved it</p>
  
  <p>After looking at the System blocks, I noticed they had made a specific template and some utility methods to work with the widget class. So, knowing that, I extended the Mage_Adminhtml_Block_System_Config_Tabs instead of the Mage_Adminhtml_Block_Widget class. I have an example of my test below.</p>
  
  <pre><code>class Inchoo_CoffeeFreak_Block_ShowTabsAdminBlock extends Mage_Adminhtml_Block_System_Config_Tabs {
  protected $_tabs;
  
  public function __construct() {
      parent::__construct();
      $this -&gt; setId('test_config_tabs');
      $this -&gt; setTitle("Test Tab Page");
      $this -&gt; setTemplate('system/config/tabs.phtml');
  }
  
  protected function _beforeToHtml() {        
      for($tab = 1; $tab &lt; 4; $tab++){
          $tabCode = 'tab_' . $tab;
          $tabTitle = "Tab " . $tab;
          $this -&gt; addTab($tabCode, array("label" =&gt; $tabTitle, "class" =&gt; ""));
          for($section = 1; $section &lt; 4; $section++){
              $sectionCode = "section_" . $tab . "_" . $section;
              $sectionTitle = "Section " . $section;
              $this -&gt; addSection($sectionCode, $tabCode, array('class' =&gt; '', 'label' =&gt; $sectionTitle, 'url' =&gt; '', ));
          }           
      }
      $this -&gt; setLastSections();
      return parent::_beforeToHtml();
  }
  
  public function setLastSections() {
      foreach ($this-&gt;getTabs() as $tab) {
          $sections = $tab -&gt; getSections();
          if ($sections) {
              $sections -&gt; getLastItem() -&gt; setIsLast(true);
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The result looks like the image below.</p>
  
  <p><a href="https://drive.google.com/file/d/0By8e425vlQRuNFBxSjRuM3NKTnc/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0By8e425vlQRuNFBxSjRuM3NKTnc/view?usp=sharing</a></p>
  
  <p>The class I extended refers to "tabs" as the main section title. It separates each grouping of subtabs. The subtabs are referred to as 'sections'. My test script just loops and creates 3 tabs with 3 sections each. </p>