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.


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"/>

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') ?>
  • How would I easily know where else this header block has been referenced?
    – Leongelis
    Dec 30 '13 at 10:00
  • Easiest way is to search in all the xml layout files.
    – Sukeshini
    Dec 30 '13 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.