Here’s a quicky one 🙂 How do you change page title of every Magento page if some titles are hardcoded into controller?
Since some controllers in Magento likes to force page titles like
$this->loadLayout();
...
$this->getLayout()->getBlock('head')->setTitle($this->__('My Account'));
$this->renderLayout();
we can’t go with setTitle through layout, since controller is setting title right before rendering.
There is a simple solution for this, use another variable for title display 🙂
In page/html/head.phtml template replace default
with
or if you don’t wish to use title prefix/sufix added from Magento admin, simply with
and now just set “forced” title for pages through layout files
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>
😉