how to change any page title in magento?

Answer


Fire up your IDE and open the Magento project. Now expand the following directory: app/
design/frontend/YOUR_PACKAGE/YOUR_THEME. In my case, it is: app/design/
frontend/base/default

We will change the page template and related layout file to set our custom page title:
1. Find and open the head.phtml file from your active theme directory. In my case, the
head.phtml file is located in the /var/www/magento.local.com/public/app/
design/frontend/base/default/template/page/html/ directory.
2. Look for the following line:
<title><?php echo $this->getTitle() ?></title>

3. Now replace the line with the following:
<title><?php echo ($this->getMyTitle()) ?
Mage::getStoreConfig('design/head/title_prefix').' '.$this-
>getMyTitle().' '.Mage::getStoreConfig('design/head/title_suffix')
: $this->getTitle(); ?></title>
4. Now let's change the template to set our own custom page title. Let's say, we shall
change the page title for the customer's login page.
5. Find and open the file customer.xml from the app/design/frontend/YOUR_
PACKAGE/YOUR_THEME/layout/ directory. In my case, it's located in the /var/
www/magento.local.com/public/app/design/frontend/base/default/
layout/ directory.
6. The code inside customer.xml has a block something like this:
<!--
Layout for customer login page
-->
<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</
template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login"
template="customer/form/login.phtml"/>
</reference>
</customer_account_login>
<!--
Layout for customer log out page

We shall add a new custom reference to this block. After adding the new reference,
the customer_account_login block should look like this:
<!--
Layout for customer login page

<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</
template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login"
template="customer/form/login.phtml"/>
</reference>
<!-- New reference for page title starts -->
<reference name="head">
<action method="setMyTitle" translate="title"><title>Buyer
Login</title></action>
</reference>
<!-- // New reference for page title ends -->
</customer_account_login>
<!--
Layout for customer log out page
-->
8. We are done!

All magento Questions

Ask your interview questions on magento

Write Your comment or Questions if you want the answers on magento from magento Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---