You can't rewrite the parent class of a block/model/helper in Magento, you can only rewrite a specific instance.
Here's how Magento's class rewriting works. Whenever core Magento code (and well coded modules) instantiate an object, they do it with a factory method.
$layout->createBlock('core/template');
The core/template
string is a class alias. Magento uses this to lookup the actual class name to use. By default, this is Mage_Core_Block_Template
. When you create a rewrite, you're telling Magento
Hey, whenever you create a
core/template
block object? Use my class instead.
The problem? There are many blocks in Magento which inherit from the core/template
. When Magento instantiates one of these
$layout->createBlock('page/html_head')
It resolves to the class Mage_Page_Block_Html_Head
, which inherits from the core template class
#File: app/code/core/Mage/Page/Block/Html/Head.php
class Mage_Page_Block_Html_Head extends Mage_Core_Block_Template
{
}
In other words, there's no way for the rewrite system to know about your swapped in core/template
class.
So when you say
in the core block function, it gives me all the PHTMLs that are being loaded, while in the rewritten block I get only some of them
It sounds like you're seeing PHTMLs for the core/template
blocks, but any blocks that inherit from Mage_Core_Block_Template
are skipped.