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

Including html files

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I want to include a file for a page footer, I've been trying to get it to work like this:<br>&lt;!--#INCLUDE FILE='something.html'--&gt; (those are quotes)<br><br>but it just can't happen. I dunno know the structure of an inc file so if anybody knows how to solve the problem i would love some help.<br><br>
 
um, those inc usally work on Serverside type stuff like ASP only, dont they? <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Yeah Server Side Includes only work on the server.<br><br>Try useing the &lt;layer src=&quot;..&quot;&gt;&lt;/layer&gt; and &lt;iframe&gt; for IE.
 
basic include: your server must allow SSI (server-side includes) which not all of them do.

<!-- #include virtual=&quot;filename.html&quot; -->

that's it. Good for headers and footers and other common stuff!
 
I don't have a lot of experince with this stuff, but you might be able to use an external javascript file. This is what I've played around with.

// JAVASCRIPT.JS - FOOTER TEXT

function footercolor(BGcolor, FONTcolor){
var BGcolor2=&quot;LIGHTGREEN&quot;;
var FONTcolor2=&quot;RED&quot;;
var SIZE1=&quot; SIZE=-1&quot;;
if(BGcolor>&quot;&quot;)
BGcolor2=BGcolor;
if(FONTcolor>&quot;&quot;)
FONTcolor2=FONTcolor;

var xA, xB;
xA = &quot;<TD><B><A HREF=&quot;
xB = &quot;</A></B></TD>&quot;

document.write('<p><center><FONT COLOR=' + FONTcolor2 + 'SIZE=3>');
document.write('<table border=6 BGcolor=' + BGcolor2 + '><tr>');

document.write(xA +'&quot;#TOPOFPAGE&quot;>Top of Page'+xB);

document.write(xA +'\'JavaScript:window.location=&quot;view-source:&quot;+window.location.href\'>View Source'+xB);

document.write('</tr></border></table>');
document.write('<nohref></FONT><FONT COLOR=' + FONTcolor2 + SIZE1 + '>');
document.write('<a href=&quot;mailto:countryfan@your.com&quot;>countryfan@your.com</a><BR>');

document.write(document.title + '<br>');

var m = &quot;Page updated &quot; + document.lastModified;
var p = m.length-8;
document.write(m.substring(p, 0));
document.write();

document.write('</FONT></center></p>');
}

Then put this in your html:

<SCRIPT LANGUAGE=&quot;JavaScript&quot; src=&quot;footer.js&quot;></SCRIPT>
<SCRIPT>footercolor('LIGHTGREEN', 'BLUE');</SCRIPT>
 
Kevorka,

Don't really know much about what I'm doing. I just play with it till it works. A lot of the code could be simpler, but I like to try different ways of doing things.
 
that's well and good but what if the client has javascript turned off ?

it's much better to let the server do the including if possible.
asp, coldfusion, ssi, or perl are commonly used for that purpose
 
Alas, TechDude is correct in pointing out that the client may not have a javascript enabled browser. I just like that sexy javascript code. Party pooper! ;)
 
try changing the the extension so if you have

<!--#INCLUDE FILE='something.html'-->

change it to

<!--#INCLUDE FILE='something.asp'-->

and it should work. :}
Tell me if your successful.
[sig][/sig]
 
you can use FrontPage to include the file, first create or open a existing web then do &quot;Insert -> Component -> Inclde Page&quot;, this way you don't need to worry about the serverside type file like (ASP)

Chiu
 
of course that kind of defeats the purpose doesnt it Chiu, I mean that would be like a simple Cut&Paste into the page. Reason I say this is because in ASP, one of the big benefits of using Includes is so that you can change one source, which affects all files that includes it, as well as saving space. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top