Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Side Include Question

Status
Not open for further replies.

robert89

Technical User
Nov 19, 2003
125
CA
Not sure if I have the right forum but here goes.

Have just rediscovered includes.

I have an existing site that we want to display within our site. We do not want to use frames, however, we want the header and footer of our site to display at the top and bottom of each page of the existing site. i.e.
Myheader
Existing Site (totally intact)
Myfooter

I ran an experiment using includes. Placed an include just below the <body> tag and another include just above the </body> in the index page of the existing site. Had to save the file as shtml. The resulting page was just what I was looking for.

My problem, from my understanding, if I wanted to place the includes in the remaining pages of the existing site, I would have to save each page with an shtml extension. This then means I would have to change all the existing site's internal links to shtml as well.

Is there away around this. Can I have those who look after the server at work set my *.html pages to allow includes.

Or are there any ideas of other approches. The main idea is that I make as few changes to the sources files in the existing site as possible. A three frame page would be perfect, but as I mention, I can't use frames.

Look forward to any help.
Bob
 
If you want to use SSI (Server Side Includes) then you will need to rename your .html files to .shtml. I dont think you can get around this.

Another option would be to have them as .asp files but that leaves you with the same problem of renaming files.

With ASP files you can include files like this:

[blue]header.asp[/blue]
Code:
<html>
<head>

</head>
<body>
[red]your header code here[/red]

home.asp
Code:
[blue]<!-- #include file = "include/header.asp" -->[/blue]

[red]your page content here[/red]

[green]<!-- #include file = "include/footer.asp" -->[/green]

[green]footer.asp[/green]
Code:
[red]your footer code here[/red]

</body>
</html>

Tony

Spirax-Sarco - steam traps control valves heat exchangers
Sun Villa - Luxury Florida accommodation
 
Hi FesterSXS,
First of all, thanks for reading and understanding the example. Makes your information more valuable.
Was aware of the ASP option (but not the exact code), and will probably do a mock-up based on this. Creating one/two asp templates and doing a global update of the html links in the exisiting site would produce the result fairly quickly i.e. low labour/time cost.

Anyway, thanks again.

Bob
 
There is a way to make the server scan all .html files for SSI, not just .shtml files. With Apache its very easy to do. It shouldn't be difficult for other servers. However, your server maintainers may not want to do it, since it would then scan all .html files for SSI - an overhead they may not want to incur. I don't know if it is possible to do it on a directory level, but I doubt it.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top