How do I write html to magento footer in a module

I am trying to make a basic Magento module that writes to the footer of a store.

Here’s what I’ve got so far.

<?php
  class CTRL_DRP_Block_Footer_Footer extends Mage_Page_Block_Html_Footer{

    protected function _toHtml(){
      $html   = 'CPTEST';
      return $html;
    }
}

I’m not sure if I’m heading in the right direction here. Can someone send me resources to help me learn how to go about this correctly?

Any help is appreciated.

One thought on “How do I write html to magento footer in a module”

  1. The footer block already exists so you only need to add a simple block inside it.

    • In your module’s config.xml file define a layout file.

      ...
      <frontend>
          <layout>
              <updates>
                  <YOUR_MODULE>
                      <file>YOURMODULE.xml</file>
                  </YOUR_MODULE>
              </updates>
          </layout>
      </frontend>
      ...
      
    • In the base theme’s layout/YOURMODULE.xml file add to the footer block.

      ...
      <default>
          <reference name="footer">
              <block type="core/template" name="YOUR_MODULE_footer" template="YOURMODULE/footer.phtml" />
          </reference>
      </default>
      ...
      
    • Create the appropriate template/YOURMODULE/footer.phtml file for the same theme.

      <p>CPTEST</p>
      

Leave a Reply

Your email address will not be published. Required fields are marked *