This example is going to assume we are moving the poll block from the right side of the page to the left side of the page.
Assuming that you want to move a block on a magento page from its current location to another location on the same page, you need to do the following:
- Find the container the block is currently in. In this case the reference name is ‘right’.
- Find the name of the block. In this case, ‘right.poll’.
- Find the container the block is going to. In this case the reference name is ‘left’.
- Unset the current location, and insert to the new location.
A simple layout example file:
<layout> <default> <reference name='right'> <action method='unsetChild'><name>right.poll</name></action> </reference> <reference name='left'> <action method='insert'> <name>right.poll</name> <sibling>catalog.leftnav</sibling> </action> </reference> </default> </layout>
The sibling option allows you to tell the insert where in the section the block will be inserted, in this example, after the catalog block.
That’s it. Relatively simple, but very useful if you want to rearrange your Magento site.