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
Marc Jenkinson
554 PointsPHP Variable for Title tag not working
Inside page "ability-gives.php" has declared the name for $pageTitle, and my header.php is echoing the $pageTitle, but the result is not rendering in the browser.
I know that the header.php is being accessed by the inside page but this string is not working.
see screenshot: https://www.dropbox.com/s/rh0dqo6wt8ribkz/Screen%20Shot%202014-03-19%20at%2011.26.34%20PM.png
3 Answers
Andrew McCormick
17,730 Pointsyour include is before you define the variable. So you are basically echoing a variable that isn't defined yet.
Ricardo Hill-Henry
38,443 PointsYou need to set your variables before you use the include, if you want to see the update on the current page. In the include, your variables hold their default values, but aren't being changed until after the include is ran, so their updated values aren't being passed in.
Marc Jenkinson
554 PointsThank you!!