As far as I can see, the problem is that you specify your block in the default layout descriptor, while most of the content in the content block is added by other layouts that are applied later. This is why the added dependencies in your XML log file (mentioned by Fabian) do not help.
Please consider these two options depending on your needs:
1. If you really want to include your block in all external pages
In your XML layout file (local.xml or custom) add a new layout descriptor :
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <add_my_block> <reference name="content"> <block type="mymod/blockname" name="myblockname" after="-" template="mymod/block.phtml"/> </reference> </add_my_block> </layout>
Now you are creating an event observer to insert your layout into your layout:
<?php class YourCompany_YourExtension_Model_Observer { public function addBlockAtEndOfMainContent(Varien_Event_Observer $observer) { $layout = $observer->getEvent()->getLayout()->getUpdate(); $layout->addHandle('add_my_block'); return $this; } }
Then you register the event observer in the XML extension configuration file (config.xml):
<?xml version="1.0" encoding="UTF-8" ?> <config> <modules> <YourCompany_YourExtension> <version>0.0.1</version> </YourCompany_YourExtension> </modules> <frontend> <events> <controller_action_layout_load_before> <observers> <mymod_add_block_at_end_of_main_content> <type>singleton</type> <class>mymod/observer</class> <method>addBlockAtEndOfMainContent</method> </mymod_add_block_at_end_of_main_content> </observers> </controller_action_layout_load_before> </events> </frontend> <global> <models> <mymod> <class>YourCompany_YourExtension_Model</class> </mymod> </models> </global> </config>
Your block should now be below the rest of the blocks. I successfully checked this on the home page, login page and category browse page. If you need to exclude your block on several pages, you can check your event observer if the block should be excluded on this specific page.
2. If you want to include your block only on some pages
Add the layout layout to the XML layout file in the same way as we did before, but instead of creating and registering an event observer, just tell your XML layout file to use a custom layout descriptor in some areas:
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <catalog_category_default> <update handle="add_my_block" /> </catalog_category_default> <catalog_category_layered> <update handle="add_my_block" /> </catalog_category_layered> <cms_page> <update handle="add_my_block" /> </cms_page> <add_my_block> <reference name="content"> <block type="mymod/blockname" name="myblockname" after="-" template="mymod/block.phtml"/> </reference> </add_my_block> </layout>
Matthias zeis
source share