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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include files

Status
Not open for further replies.

rjoubert

Programmer
Oct 2, 2003
1,843
US
I have recently taken over support of an internal website which is hosted on a Windows 2000 box running Sun's iPlanet web server. I have been told by the group that administers the server that SSI (server side includes) are not allowed.

This, of course, makes my life 20 times more complicated than it needs to be. The site I support is a simple, static HTML site with no bells and/or whistles. But, it does have the same footer on every page. I would like to be able to use an include file for the footer, but since I am not allowed to do so, does anyone know of a way around this?
 
Are you using Dreamweaver or another html editor that allows you to create templates?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
How about the following method (not a good though)

create a footer.js
Code:
document.write("<div>");
document.write("footer content");
document.write("</div>");

and call this javascript at desired place
Code:
<script type="text/javascript" src="footer.js"></script>
 
Do you know if you can use PHP?
Code:
<?php include ("file.name"); ?>
 
I would suggest having a word with the server admin and asking what server side scripting you can use. I would suggest PHP always but as its a windows box you may have some other options?

------------------------
 
Last options, if all else fails: either use flash or make the footer an image that you set as the background of a <div>

Or do both.

illustration and webdesign
 
Please dont do that. Its an option to get around this problem but its deffo not something that i would recomend for best practice.

Find out if you can use any serverside scripting and if not look into getting some installed.

------------------------
 
Allow me to reiterate a point made in my OP...SERVER SIDE INCLUDES ARE NOT ALLOWED. I've already had this discussion with our admin group.
 
Frames! You can set up a frameset and share common footer.html across all other pages using this technique. It makes my teeth ache proposing it to you... but without any form of SSI (which is a very odd requirement from the business) you can either do down the javascript route or the frameset route.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Does the solution have to be accessible? If so, JS is out, and as SSIs have already been ruled out, frames are really the only option.

If that grates you as much as it does me or Jeff, then hard-coding the string on each page really is your only option.

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 

Dan / Jeff... How could you?! [lol] - You know this thread is going to make us all cry, especially because this actually is best suited to frames due to the bizarre mandates in place....

speaking of which..
Allow me to reiterate a point made in my OP...SERVER SIDE INCLUDES ARE NOT ALLOWED. I've already had this discussion with our admin group.

I know that your admins have said this, and have probably 'defended' it when you questioned them about it... but... have they given you a business justified reason why this is the case ? Do they understand what this means ?

Designing a bad solution to fit around 'unfounded policies' that are likely 'made-up' out ignorance is not a business justified reason, and is detremental to the business. Making your business managers aware of this may help... just accepting such a 'strange' mandate (I can only assume is some sort of excessive, outdated security precaution, or lack of understanding) - is only going to make things worse... fix the root cause, not the resultant effects.



A smile is worth a thousand kind words. So smile, it's easy! :)
 
hercj said:
Do you know if you can use PHP?

Did you consider this suggestion? PHP may be supported even if SSI isn't (Although I agree with other posters that that would be a bizarre combination of mandates). But on the off chance that PHP is supported, you could do PHP includes:
Code:
<?php include ("file.name"); ?>

You don't have to know any other PHP besides this to do PHP includes. The remainder of a PHP page can be straight HTML. You would, unfortunately, have to change the extension of all pages to .PHP.

Mike Krausnick
Dublin, California
 
How many pages are we talking about here?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Love the comments in this post about frames, love the reaction, and for once i am pleased that people react that way!

Do we know if this is for external or internal web?

I could not agree more with damber's post above. It seems so odd that this is something you really need yet they are not willing to look into?

------------------------
 
Ok, let me try and answer your questions here...

traingamer...we're talking roughly 100 pages

mkrausnick...no php either

jamesgmills...internal site only

damber...the reason I was told was that they have app servers (coldfusion, websphere) that already support this type of thing. Of course, our site is not on either of
those two app servers.

I have been given the option of porting it to Coldfusion, but that may involve more effort than I can afford to commit at this point in time.

I guess the real question is if Sun's iPlanet web server has some sort of include file functionality? Judging by your replies thus far, it probably doesn't.

I'm anticipating that I won't be making frequent changes to this site, so the footer wouldn't need to be updated very often. I certainly don't want to go down the route of using framesets...been there, done that, never want to return. If, in the future, I am afforded the time to devote to making this site all that it can be, I will certainly look into porting it to ColdFusion, but for now, I'll just deal with the painful task of updating each and every page. Thanks to all for your input.
 
Maybe this is a stupid question, but why couldn't you just write a program to do the include on your machine instead of the server?

For example, you could use a command-line PHP program on your development machine to generate static pages. Here's a quick example:
Code:
<?php
$file = $_SERVER['argv'][1];
$out_file = "new-$file";
ob_start();
include($file);
$output = ob_get_contents();
ob_end_clean();
$fh = fopen($out_file, 'w+');
$ret = fwrite($fh, $output);
fclose($fh);
?>
This would allow you to use PHP includes in your pages, then run "php somefile.html" from the command line, and end up with new-somefile.html that has your included footer in it. Of course, you'd want to pick a better naming convention, but you get the idea. The point is that you'd only need PHP on your machine, not the server, so you could keep the admin group happy. You could, of course, do something similar in any other programming language you happen to be comfortable with (Perl, Python, VB, etc.).

Not an ideal solution, but I thought I'd put the idea out there. To me, it sounds better than updating all those files manually.
 
My understanding is that ColdFusion is similar to PHP, in the sense that CF commands are embedded within a normal HTML document, like this:
Code:
<html>
<head>
<title>Hello World</title>
<head>

<body bgcolor=ffffff>
<center>
	<br><br><h1>Hello World!!</h1><hr>
	<b>Today's date is:</b><br>
[red]	<cfoutput>
	<cfset today = now()>
	<i>#today#</i>
	</cfoutput>[/red]
</center>
</body>

</html>
So your existing HTML documents are already also valid CF documents, albeit without containing any actual CF commands.

So maybe your best option is to take up the offer of tranferring your pages to CF, and then using the CF include statement to add in your static files.

In answer to your other question, though, it appears that iPlanet handles includes the same as Apache does - see . You could just try them and see if they work anyway.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top