1

I have a module (capps_cact) that I cannot see the html output on the front end. I know my etc/module/capps_cact.xml file is working because I can go into the backend of magento and disable the output (config/developers/advanced). All I am trying to do with this is add the following before the closing body tag.

In my config file all I have is a reference to a layout update file. In the layout update file I just call a phtml file that only has that block to add before the closing body. I will paste my code for all files below, and here is a link to download the zip files (i thought that might be easier). My Source

first my capps_cact.xml located in app/etc/modules/capps_cact.xml

<?xml version="1.0"?>
<config>
<modules>
    <capps_cact>
        <active>true</active>
        <codePool>local</codePool>
    </capps_cact>
</modules>
</config> 

now my extension in app/code/local/capps/cact/etc/config.xml

<?xml version="1.0"?>
<config>
<modules>
    <capps_cact>
        <version>1.0.0</version>
    </capps_cact>
</modules>
<frontend>
   <layout>
        <updates>
            <capps>
                <file>cact.xml</file>
            </capps>
        </updates>
    </layout>
</frontend>
</config>

now my layout file in app/design/frontend/base/default/layout/cact.xml

<?xml version="1.0"?>
<layout version="0.1.0">
<default>
    <reference name="before_body_end">
        <block type="capps/cact" name="capps_cact" as="capps_cact" template="capps/cact.phtml" />
    </reference>
</default>
</layout>

now my block file in app/design/frontend/base/default/template/capps/cact.phtml which just has the one line.

<!-- This is a test -->
Adam Capps
  • 119
  • 3
  • 14
  • 1
    Take a look @ http://stackoverflow.com/questions/2451454/what-are-your-common-magento-configuration-mistakes .. I'm not sure what effect NOT using camelcase file name will cause. – MagePal Extensions Feb 04 '14 at 14:43
  • I changed all the code to be camel cased based on the GoogleAnalytics module (core). It appears to all be the same case structure but that didn't fix it =(. I updated the source .zip file above if you would, double check it for me? – Adam Capps Feb 04 '14 at 15:12

1 Answers1

1

Your module is not configure correctly ...

  1. Cact.xml should be cact.xml

  2. you do not have a block type type="capps/cact" (should be in app/code/local/Capps/Cact/Block/Cact.php) or you could change the block type Understanding Magento Block and Block Type

Take a look @

http://excellencemagentoblog.com/magento-part4-series-helloworld

http://www.gravitywell.co.uk/blog/post/how-to-creating-your-own-custom-block-in-magento

Community
  • 1
  • 1
MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62