2

i mean remove all the sub blocks but keep the space of their parent block . i write in the custom layout of the admin panel.

<reference name="header">
<remove name="-" />
</reference>

but this seems don't work, i change the "-" with "*" ,still no luck, what should it be ?

robertshare
  • 172
  • 1
  • 7

1 Answers1

0

If you want to remove all the children and keep the parent block as it is, then this is what you need to do.

<layout>
    <[appropriate_layout_handle_here]>
        <reference name="[parent_block_name]">
            <action method="unsetChildren"></action>
        </reference>
    </[appropriate_layout_handle_here]>
</layout>

As you can see, unsetChildren() method is what do the trick here.

There is another alternative method. You can try this also.

<layout>
    <[appropriate_layout_handle_here]>
        <remove name="[parent_block_name]">
        <block type="[parent/block_type]" name="[parent_block_name]" as="[parent_block_alias_name]" template="[parent/template/name.phtml"></block>
    </[appropriate_layout_handle_here]>
</layout>

As you can see, we are just removing the parent block initially. This will remove all children block as well as the parent block itself. Then we are redefining the parent block again. This will give you the parent block with all removed child blocks.

Hope that makes sense.

Rajeev K Tomy
  • 17,234
  • 6
  • 61
  • 103