I had a custom page where I had to rewrite page/page.phtml, and inside the template file I needed some methods. So I had to rewrite the base class Mage_Page_Block_Html. This is how my module's layout xml look liked:
<vendorpage_index_index> <reference name="root"> <action method="setTemplate"> <template>page/vendor.phtml</template> </action> </reference> </vendorpage_index_index> and the rewrite in the module's etc/config.xml:
<blocks> <page> <rewrite> <html>OurCompany_Vendor_Block_Frontend_Vendor</html> </rewrite> </page> </blocks> And it worked perfectly. However, Later, I found that it might make a conflict, because it rewrites the block class which is used everywhere, and it might rewrite other modules' rewrites. I removed the above rewrite xml, trying to redefine the block name root
<vendorpage_index_index> <block type="vendor/frontend_vendor" name="root" output="toHtml" template="page/vendor.phtml" /> <vendorpage_index_index> But the problem was, I had to manually add millions of child blocks which were added to the root block manually. I suppose this is because of occupying the root block with a different type making the root forget all its children elements.
So I added the millions of blocks which were assigned to the root before the handle root occupation. Now I have a very long layout file full of duplicates,
<vendorpage_index_index> <block type="vendor/frontend_vendor" name="root" output="toHtml" template="page/vendor.phtml"> <millions of blocks ...> </block> <vendorpage_index_index> which Evils of Duplication (®) are chasing. How do I avoid the duplication?