Magento Certified Developer GuideCategory: 3.2 BlocksHow does the $this variable work inside the template file?
Manish Prakash Staff asked 5 years ago

In the Mage_Core_Block_Template class there the “fetchView()” which actually displays the template file.
Here we see that the template file is included using the “include()” php function. As per the function documentation include() has access to all scope variable at the line of include. So that is why $this works inside template files.