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!

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 Build a Simple PHP Application Creating the Menu and Footer Including the Header

John Haas
John Haas
1,756 Points

Title tag

What is the point of echoing the title tag? Why add in PHP for that?

1 Answer

Daniel Johnson
Daniel Johnson
104,132 Points

Don't think of websites as having each individual page title created manually. This is fine for smaller websites, but almost all pages of a modern web app are generated dynamically with reusable templates, and so you need to dynamically generate your title based on what page is loaded, what information should be displayed, and where in the title it should appear.

Unfortunately, the video you watched on Treehouse doesn't really give you a good example of how this works. They're using a reusable header template, but they're still not dynamically creating a unique title based on what page gets loaded. If you're not dynamically creating a title then you don't need to use code to create the title like they're doing in that video.

Later on in the course they show you how to change the title based on what page is loaded though.