Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Slim Basics & Twig Templates Layouts with Twig

Change the title in the header when using twig or any other information contained in a block.

Hello,

I am watching the twig video where Hampton is changing index and contact files to twig files and I am wondering something.

He creates a block for the header that will be used with both the about and the contact page but what if he wants the title in the header to be different for each pages?

Is it possible to change it and if so, how can this be done?

1 Answer

Hussein Elhussein
PLUS
Hussein Elhussein
Courses Plus Student 2,982 Points

i think it is possible by replacing the actual contents of the title tag inside the head, with a variable contains the title, and then set this variable in each controller in the index.php file