0

I've opened my the 1column.phtml file and I'm trying to capture dynamically the Meta Title of the product using the following snippet:

$this->getLayout()->getBlock('head')->getTitle();

Then I'm trying to put it in the tags of the same page:

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

but no lack...

Any advice?

Thank you

  • I don't understand what you are trying to achive ... can you please add a more detailed description? – sv3n Jun 6 '17 at 15:20
  • If you go to Catalog -> Manage Products then select a product and then go to Meta Information, there is a Meta Title field there. I want to be able to capture that value in the page using code, and put that value as a page title. I'm using this code: $this->getLayout()->getBlock('head')->getTitle(); but when I'm putting it in the <title> tag in the page I see no difference. – Stefanos Jun 7 '17 at 7:40
0

perhaps you forget the echo ?

<title><?php echo $this->getLayout()->getBlock('head')->getTitle(); ?><title>
| improve this answer | |
  • aahhh.. sorry... I was a typo. The echo was there I forgot to include it here – Stefanos Jun 7 '17 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.