Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

.12840 Release Question - Getblockhtml Method
 
NickL
Sr. Member
 
Avatar
Total Posts:  188
Joined:  2007-08-31
 

way to keep pushing ahead guys! I love it! Congrats on the new release I can’t wait to get it installed…

Quick question about one of the new Enhancements

ENHANCEMENTS:

* Added Block_Abstract::getBlockHtml method

Can someone give me some details on this? From a templating view can we now call specific Block methods?  What’s a scenario of how this could be used?

 
Magento Community Magento Community
Magento Community
Magento Community
 
_
Sr. Member
 
Total Posts:  152
Joined:  2007-08-31
 

Nick, look at Moshe’s reply : http://www.magentocommerce.com/boards/viewthread/354/

Each block has a name (defined by < block ... name="block_name" > in layout xml)
and most blocks have a child alias (defined by < block ... as="child_name" > in layout xml)
<?=$this->getChildHtml('child_name')?>
is used to simplify templates and make use of the layouts.

From your request it looks like you don’t really care about layouts structure.
In your case I would use just block name which is accessible from any template:
<?=$this->getLayout()->getBlock('block_name')->toHtml()?>

Which might be reduced to:
<?=$this->getBlockHtml('block_name')?>
in future releases.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top