- Getchildhtml (' a ') //Load as= ' a ' block
- Getchildhtml ("); //Load all child blocks
- getchildchildhtml (' container1 ', ' B ', true, true); //Loading sub-block Container1 and his sub-block (as= ' B ');
- getchildchildhtml (' container1 ', ', true, true); //Load sub block Container1, and all sub-blocks below
- <?php echo $this-getchildchildhtml ( ' container1 ', ', true, True)?>
- <?php echo $this-getchildchildhtml ( ' container2 ', ', true, True)?> /c9>
In the Magento default configuration, the HTML output starts with a block named "Root" (in fact, because the block has an output property "Efish Note: Any block that has an output property is a top-level block, In the case of multiple top-level blocks, the Magento will output HTML in the order in which the blocks are defined. We've covered the "root" block template
template="../../../../../code/local/Alanstormdotcom/Helloworld/simple_page.phtml"
The find path to the template file is the root of the current theme (theme), Magento the default settings here
app/design/frontend/base/default
Add content to a pageSo far, our pages have been more boring and nothing. Let's add some meaningful content to the page. Modify Local.xml as follows
<reference name="root">
<block type="page/html" name="root" template="../../../../../code/local/Alanstormdotcom/Helloworld/simple_page.phtml">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/>
</block>
</reference>
We nested a block of "customer_form_register" inside the "root" block. This block is Magento, which contains a user registration form. We embed this block inside, so we can use the content of this block in the template file. Use the following method to modify the simple_page.phtml
<body>
<?PHP echo $this->getChildHtml(‘customer_form_register‘); ?>
</body>
The "getchildhtml" parameter here is the name of the block to be introduced, which is very convenient to use. Empty the Magento cache, refresh the Hello World page, and you should see the user registration form on the red background. Magento also has a block called "top.links", let's add it in. Modify Simple_page.html
<body>
<?php echo $this->getChildHtml(‘top.links‘); ?>
<?php echo $this->getChildHtml(‘customer_form_register‘); ?>
</body>
Refresh the page and you'll see that the
We modified the Local.xml file as follows
<reference name="root">
<block type="page/html" name="root" template="../../../../../code/local/Alanstormdotcom/Helloworld/simple_page.phtml">
<block type="page/template_links" name="top.links"/>
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/>
</block>
</reference>
Empty the Magento cache, refresh the page, and you'll see a row of links showing up. Efish Note: If you're careful, you'll find that the "top.links" block has no template attribute, because the default template must be defined in this block's class
protected function _construct()
{
$this->setTemplate(‘page/template/links.phtml‘);
}
The use of the Magento function getchildhtml () and getchildchildhtml ()