Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento code for $this->getChildHtml('topContainer');

I am coding a magento theme. I have enabled path hints but in the header the call to $this->getChildHtml('topContainer'); does not reveal any path hints. How can I find out which .phtml file is loaded when the above call is made, so that I can create the appropriately named and located .phtml custom file?

like image 468
user1527429 Avatar asked Jul 28 '12 10:07

user1527429


1 Answers

topContainer is a "page/html_wrapper" block. It means there is no template file associated with it.

The role of this block is to render all it's children blocks inside an html element. Take a look at the _toHtml() method in 'app/code/core/Mage/Page/Html/Wrapper.php'.

Sincerely,

Jonathan

--- More explanations:

You can take a look at a perfect exemple in:

  1. layout/customer.xml (in base theme)
  2. layout/sales.xml (in base theme)

You have a similar block:

<block type="page/html_wrapper" name="my.account.wrapper" translate="label">

It's the area where all other blocks of customer account will be rendered. In order to put the blocks in this area, you have to create a "reference" node with attribute "name" set to the name of the "wrapper".

For exemple if you look (inside sales.xml) to the "sales_order_view" handle, you'll see <reference name="my.account.wrapper"> and inside this node, other blocks.

These other blocks are classics blocks (core/template) and they have templates files.

So you can compare a 'page/html_wrapper' block to a 'core/text_list' block. The only difference is the first one will wrap the rendered child block into an html element.

Take a look to the 2 files mentionned above, they will help you a lot.

like image 68
Jona Avatar answered Oct 16 '22 12:10

Jona