Magento – Newsletter Subscribe Form in Footer or Header

Written by Adrian Hart

Topics: Magento

It used to be the case that to move your Newsletter Subcribe form, or other Magento blocks, from their original position in your Magento template you would need to go and find the relevant lines in the layout XML files and modify them to show in a new postition. This however was a tedious process; especially when it came to precise positioning on your page.

Now you can create a block on the fly and position it precisely in your template files with one line of code. So here it is…


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


This code can be used for other types of block. Say you had a template file which would call a list of products from the catalogue, you would use createBlock(‘catalog/product_list’)

Leave a Comment Here's Your Chance to Be Heard!