2

While I am studying the Magento Basic Tutorial, there is a question confused me.

I noticed that in the /template/page/html/header.phtml rendered a child block called 'topSearch'.

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

However, I opened the layout associated file (page.xml), that child block was not defined under the header block. And my understanding from Magento documentation Layout Chapter, that child block would not be rendered.

a Block can only render a child Block if the child Block is included as a nested Block in the Layout XML file.

Teja Bhagavan Kollepara
  • 3,816
  • 5
  • 32
  • 69
Leongelis
  • 585
  • 8
  • 21

1 Answers1

2

app/design/frontend/base/default/layout/catalogsearch.xml defines the search box to be displayed in the header.

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

And this block will be rendered in app/design/frontend/base/default/template/page/html/header.phtml

<div class="quick-access">
            <?php echo $this->getChildHtml('topSearch') ?>
Sukeshini
  • 9,945
  • 18
  • 71
  • 126