Newsletter – Positioning Subscription Box in Footer

blocksnewsletterxml

EDIT: SOLVED, see answer below (will accept when I can).

I wanted to move the newsletter block on the frontend of my site to the footer.

So I changed this in newsletter.xml: (
Previously the reference was <reference name="left">)

    <!-- Mage_Newsletter -->
    <reference name="footer">
        <block type="newsletter/subscribe" name="footer.newsletter" template="newsletter/subscribe.phtml"/>
    </reference>

This has worked in that the newsletter has moved to the footer, but how can I control where the block is positioned within the footer.

I tried this in my templates … page/html/footer.phtml:

<div class="footer-container">
    <footer class="footer">
        <div class="row">
            <div class="nine columns">
                <?php echo $this->getChildHtml() ?>
            </div>
            <div class="three columns">
                <?php echo $this->getChildHtml('footer.newsletter') ?>
            </div>
        </div>
...

But this duplicates the newsletter block. Now it appears once in the place I want it to be (in the three-column div) but then appears again in the nine-column div.

I assume this is because it is included in the '$this->getChildHtml()' call.

I would really appreciate any help, thanks. Definitely missing a trick somewhere.

Best Answer

Just add below single line & it works

<?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml(); ?>
Related Topic