Any way to "include" html file

They have: 12 posts

Joined: Sep 2002

I have a web site with about 75 pages. At the bottom of each page is a "mini site map" with links to all the primary pages.

Is there a way to create one file with the required html and then "include" it in the desired spot of the other pages? It sure would make site maintainence easier.

If you have a suggestion of alternative ways to handle this situation, I'm all ears.

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

I'm sure you will need to use SSI (server side includes) for this but I'm not 100% on the actual doings of it.

Busy's picture

He has: 6,151 posts

Joined: May 2001

javascript, I used to use this method before I found PHP

<script type="text/javascript" src="added.js"></script>

If JavaScript is disabled it wont show thou.
Can you use PHP or ASP or anything?

He has: 1,016 posts

Joined: May 2002

To use SSI you'll need to rename all your HTML files to .shtml (assuming SSI is enabled on your webserver) or use .htaccess to parse .html files as SHTML files.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

BigNoseBird.com has a good SSI tutorial. Here's the direct URL:

http://www.bignosebird.com/ssi.shtml

The include code basically looks like this:

They have: 12 posts

Joined: Sep 2002

Thanks especially to Megan. The bignosebird site is great!

They have: 9 posts

Joined: Oct 2002

What about using CSS and create a footer that is included on every page?

openmind's picture

He has: 945 posts

Joined: Aug 2001

Or if you use coldfusion just rename the pages to .cfm and add the tag

They have: 447 posts

Joined: Oct 1999

best method is SSI or a scripting language like PHP or ASP, but the javascript method works quite well and you dont have to modify your server configuration or rename all your files. i've used javascript to add stuff like copyright info at the bottom of pages and it works just fine. people with javascript disabled simply wont see the footer, and if they have javascript disabled theyre used to things not working right already.

you could also use an inline frame.

They have: 12 posts

Joined: Sep 2002

To Phil/Flipper: If I use ColdFusion will that have any bearing on search engine spiders being able to crawl the site?

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

There are also utilities out there that will mass rename files in a given directory or whatever you choose. I have something called "Oscar's renamer". Just in case you were worried about having to do that by hand. You can also use an extended search/replace tool (many html editors have these built in) to search/replace code in your site (i.e. search for the footer code, replace it with the include code)

How would one use CSS to include a footer? Just curious on that one...

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Yeah, TDS2599, how do you use CSS to do this? I've never heard of using CSS for this type of thing, do you have an example?

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I would think that doing an include with CSS would be completely contrary to the purpoase of CSS. Since CSS was created to hold presentation, in order to separate style from structure, why in the world would you want to, or be able to, include structural or content information in a stylesheet? That would be really weird... Wouldn't be good for accessability either.

They have: 238 posts

Joined: May 2002

You'd have a better chance with including with javascript rather than css, as Megan said, it's crazy. If you have access to server side scripting I would very strongly suggest you make use of either an SSI or PHP include.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.