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

Why add php to "Shirts 4 Mike"?

I understand why we would want to add php to the code regarding the copywrite date, since that will update automatically from our server, but why change "Shirts 4 Mike" to php code? Isn't this the same as html? You still have to type it into the code exactly....

I'm just a little confused as to if there's a use for this type of thing or if this is just an example to show that this works too.

4 Answers

Michael Aguilera
Michael Aguilera
19,379 Points

Hello Mathew,

He does this so that you can move the the entire header over to an include page but also show you how to update the title for each of your individual pages.

Hey Matthew,

Do you mean the <title><?php echo "Shirts 4 Mike"; ?></title> statement he adds, when he could have just put <title>Shirts 4 Mike</title>? I believe he's just wanting you to remember that you can echo out bits of text or code to the page using PHP if you choose to do so. There's no practical reason to do it the way he did it, so my guess would be just to show you how echo statement works.

Hey Matthew,

I think you are right in that it was to show that you can. When you get much farther along on php, you will need to echo out html as part of if statements or to include AJAX requests to the code. That little echo is quite powerful!

Happy Learning!

You're actually setting up the title to turn it into a variable in the upcoming "Using Variables for the Title Tag" video. That way the title of the page is, for example, "Contact" when you're on the contact page and "Store" when you're on the store page.