5

I've been playing around with magento's PHP files. However I cannot seem to figure out what gets pulled out with

<?php echo $this->getChildHtml('content') ?>

and from where this comes from. For instance, I can see a some text that says "Home Page" but I cannot find where this comes from by wading through the various files under /app/design/frontend/base/default and turning on template paths hints does not help.

The version of magento I am running is 1.7.0.2. Any help would be greatly appreciated.

4

1 回答 1

4

内容块是一个结构块,用于包装页面内容的所有块。getChildHtml('content') 加载所有添加到布局“内容”中的块

1. xml via <reference name="content"><block type="core/template') name="test" template="test.phtml"/>

2. code via $this->getLayout()->getBlock('content')->append($block);

'content' 中每个块的 toHtml 方法被调用以返回其 html

于 2013-06-09T21:25:45.520 回答