views:

98

answers:

6

I know that with a large site you would want to separate footers, menus, etc so that updating that file would push the update out to every page that contains the item.

Is the same recommended for a small site made purely in HTML/CSS, or is it simpler/easier/standard to code out the menu in each page and update each page when a change is needed?

I don't necessarily want to bring in PHP or etc onto this website, but the ease of updating menus would be nice. Any other suggestions? I've heard Server Side Includes might be one option... is that considered "pure html" or is more required to be set up on the server?

Thanks!

A: 

There are tons of different ways to approach this problem, but ultimately if you want to make changes on your side and have them reflected in lots of pages you're going to have to have either some kind of server side processing, which means PHP or JSP or something along those lines, or you're going to have to have some sort of process that generates your site statically updating lots of repeated items wherever they occur, but ultimately that would just be a compile time solution that's equivalent to some other server side approach.

If you're comfortable working in Java / JSP, then simple JSP includes might do everything you need. If they don't, then you could go for a full blown Portlets API application. I'm sure other languages have equally valid approaches, so ultimately its decideding what you're most comfortable with.

Jherico
+2  A: 

Server side includes isn't html, but it's not really coding either. It's probably your best option if you don't want to get PHP or some other coding solution involved.

It's mainly just a function of the webserver that you are using, and whether it's enabled for the site.

Here's a tutorial on them for Apache.

Here's documentation for IIS.

womp
+6  A: 

Unless you've got a site consisting of one page, do yourself a favor and have some separate files with your header/footer/other repeated elements.

That way you only have to make one change and its done. No matter how meticulous you think you are, you will inevitably forget a page somewhere on an update any other way. Its a human thing.

If its "just" HTML, and you're not using a server-side language, then you are correct in that you'll want to use server side includes. Check with your host to see if it will process SSI on regular *.htm/*.html files or if you need to use the *.shtm/*.shtml extension.

AnonJr
+1 because things inevitably grow more complicated than you initially thought.
Shin
A: 

Server side includes would be "pure HTML" from the browser's standpoint, but then so would PHP.

If you didn't want to Server Side Includes, you could dynamically build them using JavaScript or a library such as jQuery, and just include a .js file in each of your pages.

Shin
A: 

It is very easy to do this with php. This is some sample index.php page i've built:

http://pastebay.com/51887

And for example in "includes/navigation.php" i have this:

http://pastebay.com/51888

So in everypage you have just put that from first link and when you want to edit navigation, just edit "includes/navigation.php". :)

GaVrA
A: 

If it's really small / mostly text-based content, you could just have one page with hidden DIVs that are switched in. Then it'll also be very snappy and self-contained if someone wants to view it offline.

Kev