0
votes

starting from a mostly fresh CE 1.6.2.0 installation, I want to remove the default XML instantiation of the core/template block found in the header. This block is named "top.search" and is tied to form.mini.phtml.

In my local.xml, my first thought was to add this:

<default>
    <remove name="header.top.search"/>
</default>

This works for any other block I've tried to remove (ie, prepend the skeleton block name (eg, "header") to the beginning of the content block name), but not this one. Why?

I have found that this does work:

<default>
    <reference name="header">
        <remove name="top.search"/>
    </reference>
</default>

But of course I thought that this would be essentially the same thing.

I actually intend to move this into my navbar, so I know that I'll also need to instantiate a new core/template block in the top.menu skeleton block.

Another question that arises, however, is why is the default CSS set to use absolute positioning for .header .form-search anyway?

I guess that's two questions, but related at least :) Thanks kind sirs!

edit: thanks, So, I was simply using the incorrect block name! I was confused by the naming of the blocks which all newbies first encounter: left.permanent.callout, right.permanent.callout, which both are placed into their appropriately named skeleton blocks "right" and "left".

1

1 Answers

1
votes

<remove name="header.top.search"/> does not work because the name of block is not header.top.search. The block is defined in catalogsearch.xml like this:

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

The name of the block is top.search, so to remove it use <remove name="top.search"/>.

You don't have to put remove tags inside reference tags. Remove tags works globally for all blocks in the layout object. This is also why the name of the parent block does not matter and should not be prepended to the block name.

Regarding your CSS question, I don't know why the search block is made with absolute positioning. I guess that's just a choice made by the designer of the default theme.