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
Stephen Blank
16,286 PointsBest way to duplicate headers and footers across multiple pages
Does anyone have a tool or system they use so that if they edit their header or footer sections, those changes can be propagated across all other pages?
2 Answers
Erik McClintock
45,783 PointsSteve,
A great way to do this is through using a language like PHP. You create one file for your header, one file for your footer, and then you simply include those on the rest of your individual pages across your site. Then, if you need to make changes, you go to one place and one place only (the appropriate .php file, whether header or footer, or whatever other page template, like say a sidebar.php file), make your edits, and voila! You're good to go :)
If you haven't looked into PHP at all yet, Treehouse has a great section to get you started.
Erik
Rich Bagley
25,869 PointsHi Steve,
I know this is listed in HTML so not trying to confuse anything but do you mean software-wise or language-wise?
Using something like PHP can allow you to create one header/footer file and include it in several pages.
This would mean you could then edit it in one place and it would display the same across all pages it is included in.
Thanks
-Rich