Using assign with Magento Blocks
assign
method, which produces behavior more like a “traditional” PHP MVC view layer. I was sort of aware of this, but it never really sunk in until @vinaikopp’s tweet.
That is, if you use code like this
#File: app/code/core/Mage/Review/Block/Product/View.php
...
$this->getLayout()->getBlock('product_review_list.count')
->assign('count', $this->getReviewsCollection()->getSize())
...
then your phtml
view file will have access to a local variable named $count
.