Another Magento quickie for when you want to pass a value into your phtml template file that is set/generated inside the controller.
Inside the controller you can do this:
Where $block could be something like
$block = $this->getLayout()->getBlock(“head”) ;
if you wanted to pass the value into the head template.
You can also set a value like this:
Then, inside the phtml template file you can get the value like this
Note you can pass multiple variables through a single $block->assign() like this