So point is simple. If I have a template that is defined like this
<block type="custom/block" name="custom.block" template="custom/template.phtml" />
Then $this
that I am going to use in the template custom/template.phtml
will stand for the block class Namespace_Modulename_Block_Custom_Block
. How it is making possible in Magento.
Recently I have tried to do the same trick in a core php
work. But when I try to do
$this = new someClass();
It says, you cannot alter $this
variable like that.
This doubt is with me from the start time. I really need a nice explanation(using relevant codes) for this.
So can you enlighten me with your knowledge on this?