Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.


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
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