Wednesday 26 September 2012

Change any page title in Magento

In page/html/head.phtml template replace default

<title>< ?php echo $this->getTitle() ?></title>
with
<title>
<?php echo ($this->getForcedTitle()) ? Mage::getStoreConfig('design/head/title_prefix').' '.$this->getForcedTitle().' '.Mage::getStoreConfig('design/head/title_suffix') : $this->getTitle() ?>
</title>


and now just set “forced” title for pages through layout files

<reference name="head">
<action method="setForcedTitle"><title>Account Dashboard</title></action></reference>
Example for My Account page in layout/customer.xml:
<customer_account>
<reference name="head">
<action method=”setForcedTitle”><title>Account Dashboard</title></action>
</reference>

</customer_account>

1 comment:

Note: only a member of this blog may post a comment.