5

I am having trouble getting a custom .phtml file to output in the footer.

Here is the path to the file:

beckin/themesettings/socialaccounts.phtml

I created an xml file called beckin_themesettings.xml

Here is what I have inside of the xml file:

<?xml version="1.0"?>

<layout version="0.1.0">


           <reference name="footer">
                 <block type="core/template" name="socialAccounts" template="beckin/themesettings/socialaccounts.phtml"/>
           </reference>


</layout>

Here is how I am calling it in my footer: <?php echo $this->getChildHtml('socialAccounts') ?>

But it is not rendering the file.

However, if I move the info to the page.xml file it will work. What am I doing wrong?

Here is the relevant part of the page.xml file:

        <block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
            <block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
                <label>Page Footer</label>
                <action method="setElementClass"><value>bottom-container</value></action>
            </block>
/*** If I enter my block here it will work??? ***/
            <block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
            <block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
            <block type="beckintwitter/twitter" name="twitter_feeds" as="twitter_feeds" template="twitter/twitter.phtml"/>
        </block>

Here is my config.xml file

<?xml version="1.0"?>
<config>
    <modules>
        <Beckin_ThemeSettings>
            <version>1.0.0</version>
        </Beckin_ThemeSettings>
    </modules>
    <frontend>
        <layout>
            <updates>
                <themesettings>
                    <file>beckin_themesettings.xml</file>
                </themesettings>
            </updates>
        </layout>
    </frontend>
    <global>
        <helpers>
            <themesettings>
                <class>Beckin_ThemeSettings_Helper</class>
            </themesettings>
        </helpers>
    </global>
    <default>

    </default>
</config>

1 Answers1

7

Replace it with the following and it should work. You don't need to create another block, just reference it.

<default>
<reference name="footer">
<block type="core/template" name="socialAccounts" template="beckin/themesettings/socialaccounts.phtml"/>
</reference>
</default>
Sander Mangel
  • 37,528
  • 5
  • 80
  • 148
  • Thanks for your post. Just tried that again but that didn't work :( –  Mar 16 '13 at 16:08
  • Did you correctly add the layout file in your config.xml? – Sander Mangel Mar 16 '13 at 16:11
  • Everything looks good from what I can tell. I posted it above :) –  Mar 16 '13 at 16:20
  • i'm not sure but you might need to loose the underscore in the layout files name. I'm not 100% sure but Magento might convert that to a directory slash. – Sander Mangel Mar 16 '13 at 16:22
  • It doesn't.. The underscore is fine. I have two other xml files that use the underscore. Just to double check I removed that in both files and still nothing.. –  Mar 16 '13 at 16:25
  • also just to be sure, you are calling it like getChildHtml('socialAccounts');?> thats the last that I can think off. That and clearing your cache in the backend – Sander Mangel Mar 16 '13 at 16:26
  • I am. Sorry the above code just didn't format right. I fixed it above. Any other ideas? This is crazy lol. Not sure why it will work in the page.xml file but not my custom.xml file –  Mar 16 '13 at 16:31
  • Wait, shouldn't you add the tag around the reference to indicate what pages you want it on? – Sander Mangel Mar 16 '13 at 16:34
  • In which file are you thinking the default tag needs to be in? Maybe that is it –  Mar 16 '13 at 16:37
  • like this i mean: – Sander Mangel Mar 16 '13 at 16:38
  • Ahhhh, you are the bomb!! That was the whole problem..Thanks a million!! –  Mar 16 '13 at 16:39
  • No problem, glad to help :) – Sander Mangel Mar 16 '13 at 16:39
  • If you could + vote my question that would be great :) I think it will help others for sure.. –  Mar 16 '13 at 17:39