0

having block declaration from layout , say:

    <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>

how can i use addblock in a template for displaying the block

       /* @var $this Mage_Core_Block_Template */
     echo $this->getLayout()->addBlock($block, $blockName)->toHtml() ;
Matoeil
  • 607
  • 1
  • 9
  • 23

2 Answers2

1

we use create block

For example:

echo $this->getLayout()->createBlock('core/template')->setTemplate('catalogsearch/form.mini.phtml')->toHtml()
Rojan Shrestha
  • 404
  • 3
  • 6
1

i have found out from how to print a list of available blocks from a template?

that this was working nicely

echo $this->getLayout()->getBlock('top.search')->toHtml();
Matoeil
  • 607
  • 1
  • 9
  • 23