Magento: Passing variables among controller, block, hepler, model and template

Magento is a configuration-based Model-View-Controller web application system for eCommerce business.
MageROOT/app/code/codePool/PackageName/ModuleName/Block and template files in /app/design/……

In Magento, controller sets values on Models, then Blocks and templates reads them from the those Models. For example, we can set a string hello by using core/session model


Then we can get this hello from a block or a template or anywhere else by


You can use these magic setter and getter function from any model class that inherit from Varien_Object. The Mage::getSingleton(‘module/model’), it instantiate the model object as a singleton that will link to the same object if it was instantiate before. Thus, when you do setData($somedate), you can get it back by getData()

Search within Codexpedia

Custom Search

Search the entire web

Custom Search