"Title" is a block added with an XML layout update.
<block type="page/html_head" name="head" as="head">
The block type is page/html_head , which translates to the Mage_Page_Block_Html_Header class. If you look at the class definition, you can see the header.phtml template.
#File: app/code/core/Mage/Page/Block/Html/Header.php public function _construct() { $this->setTemplate('page/html/header.phtml'); }
When you use $this->someMethod() from a template, you call the method in the template block class. Each template "belongs" to the block. If we look at the header class again
#File: app/code/core/Mage/Page/Block/Html/Header.php public function getLogoAlt() { if (empty($this->_data['logo_alt'])) { $this->_data['logo_alt'] = Mage::getStoreConfig('design/header/logo_alt'); } return $this->_data['logo_alt']; }
we can see the definition of getLogoAlt .
In another template you specify, home.phtml , the following xml layout update is added
<block type="core/template" name="default_home_page" template="cms/default/home.phtml"/>
Its block is the core/template block, which is converted to Mage_Core_Block_Template . This block has no getLogoAlt method. However, like all blocks, it has Magento magic getters and setters. You can βsetβ and βgetβ data properties on Magento blocks as follows
$this->setFooBar('setting a value for the foo_bar data property'); echo $this->getFooBar();
even if these methods are not defined in the block. Thus, this means that you can call getLogoAlt on any block without error, but only the header will return a value. If you want to use this value in any template, you can simply call
$logo_alt = Mage::getStoreConfig('design/header/logo_alt');
at the top of the template, then use $logo_alt wherever you want.