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 trialZach Meissner
1,347 PointsIs it possible to do an HTML 'includes' for the header so we don't have to copy and paste the same information 3 times?
I'm wondering if there is an HTML equivalent to the PHP includes where you can create the code once, and have it included on all subsequent pages. For instance, when adding a new style sheet, it has to be added on every page, or when changing footer info.
For a site that will have dozens of pages, this isn't practical.
How does one easily make changes to multiple pages?
1 Answer
Craig Watson
27,930 PointsHi Zach,
Unfortunately not but, it is very achievable through well structured HTML and good use of class's and id's that should you wish to change anything the minimal amount of code will need editing.
Best advice i have is to concentrate on grouping relevant content together and if you are keeping your css nice and dry then the code to change a group of elements on multiple pages with the same background and font style should be pretty quick!
Hope this helps Craig
Zach Meissner
1,347 PointsZach Meissner
1,347 PointsThanks much Craig.
What is the Ruby on Rails equivalent of an 'includes' like in PHP? Not sure on the name of that block of code.
Craig Watson
27,930 PointsCraig Watson
27,930 PointsI wouldn't be able to tell you Zach I have 0 experience with ruby as programming language .... sorry