How to get the page Title – Magento

Here's a short snippet that retrieves the page title in Magento.

You can use in your theme files or in any module.

$headBlock = $this->getLayout()->getBlock('head'); // Just to make sure it doesn't return an error if ($headBlock) { echo $headBlock->getTitle(); }
Code language: PHP (php)

About Ricard Torres

Senior Front-end Software Engineer at Netcentric, from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

2 comments

Leave a Reply

Add <code> Some Code </code> if you need to.

*
*