Magento Forum

   
Why Wont GetTitle() work throughout Page??? 
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

If on a page the <?php echo $this->getTitle() ?> is being called in the head.phtml, why cant I call it in the footer. I drop the code in and it does not show up at all. Any ideas?
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

The header and footer block is not the same thing. When you call $this->someFunction() from a template file, you call a function in the current block. getTitle() is a function of the head block, it’s not in the footer block.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

So how would I get it to work in the footer block? If it is able to call it in the head, then there should be a way to call it in the footer as well. ??

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

This should do it:

<?php echo $this->getLayout()->getBlock('head')->getTitle(); ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

Thanks Anders Rasmussen..it worked! Can you tell me what I would need to do to display attributes of items on the product page? would it be a simular situation or would more need to be done?

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

I’m not sure what you mean. Products’ attributes are displayed by default on the product page, if they are marked as “visible on catalog pages”.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lakshyami
Member
 
Avatar
Total Posts:  44
Joined:  2010-03-25
Sri Lanka
 

Thanks Anders Rasmussen, it worked me too. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
dloca
Jr. Member
 
Total Posts:  5
Joined:  2013-12-08
 

Thanks, work for me too!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top