Magento – Add block to category page

blockscategoryce-1.7.0.2layout

I want to add a custom block to the category pages and not care if the the category is anchor or not or if it has children or not.
I want to add that block at the bottom of the page after the product list or static block.
So I added this in the layout file

<catalog_category_view>
    <reference name="content">
        <block type="some/block" tempalate="some/template.phtml" after="-" /><!-- notice the "after" attribute -->
     </reference>
</catalog_category_view>

the block appears in every category page but at the top of the page.
If I change the layout handle to catalog_category_default or catalog_category_layered everything works OK and I see my block at the bottom of the page.
Any idea why "after" is ignored for catalog_category_view handle?
Note: Using the default magento theme

Best Answer

I think I've isolated the problem.
The catalog_category_view layout handle is loaded before the _layered or _default handle and the block are generated in the order they are found. So my custom block is generated and inserted into the content before the category/view block found in the _layered handle.
So the 'after' attribute is taken into consideration and my block is added last at that point.
But then comes the _layered layout handle and because the category/view block does not have a before or after specified it is inserted like this:

$parentBlock->append($block, $alias);

That is the same thing as

$this->insert($block, '', true, $alias);

The same code is executed when after="-" is specified. So it's like category/view has after="-" specified.
This does not occur when the blocks are in the same layout handle, because usually the custom module layout handle is loaded after the one from catalog.xml.