is, one of the pieces is missing. The missing piece is determined from the context, or
reason, for getting the class. Here is the basic pattern:
"module/package_classname"
This translates into:
Mage_Module_???_Package_Classname
The ??? can only be known based on the context.
So, it can be said that mage/package_classname doesn’t refer to anything unique, it
could be one of a number of classes. This is true. But, we know from the basic struc-
ture of a module, that the only sub-directories available to us are:
• Model
• Controller
• Helper
• Block
So, the resulting class can only be one of those four, and it’s not Controller. Con-
trollers are special cases and don’t follow the normal naming conventions. The con-
text may or may not be readily apparent, but as you become more experienced with
Magento the context will be apparent. Let’s look at some examples and see the dif-
ferent contexts.
$product = Mage::getModel(’customer/address’);
//Translates into Mage_Customer_Model_Address
$url = $this->helper(’customer’)->getLoginPostUrl();
//Translates into Mage_Customer_Helper_Data ("/data" is appended
by default to helpers)
$url = $this->helper(’giftmessage/url’)->getSaveUrl();
//Translates into Mage_Giftmessage_Helper_Url
template="catalog/product/list.phtml" />