views:

208

answers:

7

Hi,

I am currently creating a web site with pure HTML ( No frameworks Just with plain HTML ).
It has lot of pages having a common navigation.

Is there a way to have feature like master pages of ASP.Net or template kind of thing which some other framework offer.

I am little reluctant to use the frame-sets.

Thanks.

A: 

I believe that the only way to do this in HTML is to manually copy/paste the common code onto each page. If you were using any kind of framework or server side code then you could have that handle it, but with straight client-side HTML it's not doable.

Perchik
+1  A: 

If you are using Apache you could use SSI Server Side Includes http://httpd.apache.org/docs/1.3/howto/ssi.html

Arkaitz Jimenez
SSI works on IIS as well.
Scott
+2  A: 

If your webserver allows you to use SSI (Server Side Includes) you can include common HTML files into your various pages to allow you to re-use some of your navigation and layout pages.

Ex.

<!--#include file="header.html"-->
<b>The main content here</b>
This content is in the main body
<!--#include file="footer.html"-->

Depending on the server configuration, you may need to change the extension of your file to .shtm or .shtml in order for the SSI commands to be processed.

Jay S
+1  A: 

Have a look at Dreamweavers Template mechanism. I've used it heavily for static websites, and it works. Copy/pasting the navigation into multiple pages isnt a good idea.

Mork0075
+1  A: 

For such websites, I use Sleepy with Python & Django.

Sleepy, allows you to create a static site by rendering Django templates to HTML.

So basically, I can still use templates in my projects and Sleepy spits out the HTML.

You'll have to learn Django though.

bchhun
A: 

You could use javascript/ajax to include files.

sprugman
Can you elaborate on this ? My take on what are you saying is : Have a central content holder say div or something.Then the JavaScript will fetch the central file depending on the navigation click. Am I right ?
Biswanath
A: 

You could use template mechanisms that editors provide, as in Dreamweaver or even TextMate. Alternatively, you could use a generator like jekyll (its Ruby-powered, but I'm sure there are others).

avdgaag