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

HTML

How is HTML edited uniformly across massive websites?

Very ignorant beginner question here, but since I've only worked with websites containing just a few pages, I'm curious how larger sites are maintained.

Let's say we have a website containing hundreds of html pages. Each page contains the same header code. If we eventually want to change something in that header, do we really need to edit hundred of html files manually? Or is there a method to make massive edits like this in just one place?

2 Answers

That's when a server side language comes into play. For example, with PHP you can put the header content into one PHP file and when you edit it there, it changes across your entire website.

Aha! Even simpler than I thought. Obviously I don't know the power of php. :)

Kevin Korte
Kevin Korte
28,148 Points

Yep Adam is right. As you learn more, you'll start to figure out how you can have everything only written once. It's known as the D-R-Y principal (Don't Repeat Yourself).

Large websites will almost always be a large collection of web files that are compiled together by the server and sent to the browser as one HTML file.

At a minimum, you might have a header and footer file that compile with an index file to make a webpage. Your sidebar might be another file that get's compiled to the index file too. That would all be done server side like Adam said.

What's the best place to begin learning this process? Do I need to go through the PHP course in depth? Or is it just a matter of knowing how to link files together with a bit of PHP? I'm trying to focus more on front-end right now, but I can see the benefit of figuring this out sooner than later.

You only need a bit of PHP knowledge to do this. Basically just using PHP's "include" function. You'd also need MAMP/XAMP if you want to work with PHP locally.

All the info can be found in the first two stages of the "Build a Simple PHP Appplication" course http://teamtreehouse.com/library/build-a-simple-php-application