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


Adarsh Prabhu
Adarsh Prabhu
15,394 Points

How do I setup a single template then have it replicate to all my other HTML pages?

Sometimes I have to make changes to the HTML of my site for example the navigation bar. To avoid having to make the change on every single page, is there a way to apply it to one page and have it sync?

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

If you mean as far as styling, then yes. I see that you've done a good deal of CSS here on Treehouse (even more than I have). You can make the changes to the styling in one CSS file and as long as every page has a link to that file then it should update site-wide.

I answered

1 Answer

Yes, but you will need to add php to your script, looking like this:

open and close php tags then type: include("header.php");

so you header.php file (.php is instead of .html) will contain everything in your navigation.


You need a live website to do this or get a localhost so you can do it locally. To do it locally you need to download xamp for windows or mamp for mac. I can put some links below



They are both free.

Hope this helps.

Maximillian Fox
Maximillian Fox
Courses Plus Student 9,236 Points

PHP is the way to go. There is a course on building a website with PHP which does all this, which will help you out immensely and also add another tool to your arsenal.

There is also a more advanced course that shows you how to use Twig and SlimPHP for template management, which are two extensions for PHP. Note that Slim is now in 3.x but the course uses 2.x, so it may be a bit tricky to follow along.