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

Ryan Scharfer
Courses Plus Student 12,537 Pointspurpose of php in title tag?
Hello, Beginner question here : What is the advantage of using php in a title tag. I am doing the beginner php course and our title tag looks like this : <title><?php echo "Shirts 4 Mike"; ?></title> I understand using php for the date because a date is dynamic. But if you are defining the title, why do it with php -- it would never change .... Thanks for any help.. Ryan
4 Answers

Erik Montes
3,717 PointsWell, in case you want to have dynamic page titles! Which is something you might want at some point to give each page an unique title such as Home, Settings, etc. But you don't have to have a dynamic title, if that's the case then you can just have good ol' text. Titles that depict the content of the page can result in good SEO (http://moz.com/learn/seo/title-tag) too, so that might be another benefit.

Erik Nemesis
13,356 PointsBecause later on it will be replaced by <?php echo $title ?>
where you have $title coming from the PHP code executed at the beginning of the file (also referred as the controller in the courses, though that's not correct)

Ryan Scharfer
Courses Plus Student 12,537 Pointsawesome. thanks guys. I just couldnt think of a reason before why you might want to change the title. I also didnt know "shirts 4 mike" would be replaced by "$title".

Ryan Scharfer
Courses Plus Student 12,537 Pointsthat php code shold be surrounded by title tags..