Magento XML $this->getChildHtml() necessary?
magento, php, xml
Solution
If you take a look at `page/html/footer.phtml`, which is the footer block's template
<div class="footer-container">
<div class="footer">
<?php echo $this->getChildHtml() ?>
<p class="bugs"><?php echo $this->__('Help Us to Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" onclick="this.target='_blank'"><strong><?php echo $this->__('Report All Bugs') ?></strong></a> <?php echo $this->__('(ver. %s)', Mage::getVersion()) ?></p>
<address><?php echo $this->getCopyright() ?></address>
</div>
</div>
You can see that they've used the following PHP to output the child blocks
<?php echo $this->getChildHtml() ?>
When `getChildHtml` is called without a parameter, it will output any block that's been added. That's why you didn't need to include your own call to `$this->getChildHtml('newsletter')`
Problem
I have edited the following file, to move the newsletter to the footer instead of the sidebar ``` app/design/frontend/base/default/layout/newsletter.xml ``` I changed the following code: ``` <reference name="left"> <block type="newsletter/subscribe" name="left.newsletter" template="newsletter/subscribe.phtml"/> </reference> ``` to: ``` <reference name="footer"> ``` Why did I not need to add ``` $this->getChildHtml('newsletter') ``` or similar to footer.phtml? I am unsure when to use getChildHtml() and when not to. Are all the steps necessary in Exercise#2 of this article ? Thanks.