including phtml file in phtml in magento
Hi I have added the inchoo featured products but want them to show in the header so show on everypage, i tried moving the code, i tried:
echo $this->getLayout()->createBlock('Mage_Adminhtml_Block_Template', 'block-开发者_JAVA百科name')->setData('template', 'inchoo/block_featured_products.phtml')->toHtml()
Im kind of new to magento so i don't know
thanks Graham
Create a CMS static block and give a identifier name to that, lets say "featured_product". Open page.xml file from app/design/frontend/default/YOURTEMPLATE/layout/page.xml Find the section html_header, now add the following code
<block type="cms/block" name="header_block"><action method="setBlockId"><block_id>featured_product</block_id></action></block>
Next open the app/design/frontend/default/YOURTEMPLATE/template/page/html/header.phtml file. Find the area to design and add the following code in there :
<?php echo $this->getChildHtml('featured_product') ?>
Clean cache and test your page.
精彩评论