• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 139
  • Last Modified:

Linking to html source docs

I have a header with a logo and an options bar which I include in every html document.  Instead of copying and pasting it into every doc, is there a way I can include it or reference it somehow, similar to how multiple source code documents can be referenced in C using the #include command?  
0
chsalvia
Asked:
chsalvia
  • 2
2 Solutions
 
RoonaanCommented:
If your server support serverside includes you could try:

<html>
  <head>
    <title>
  </head>
  <body>
     <!--#include virtual="header.html"-->
     page content
     <!--#include virtual="footer.html"-->
  </body>
</html>

-r-
0
 
chsalviaAuthor Commented:
So, this can only be done from the server side?

One way that occured to me, which is probably kind of strange, is to write the header in javascript, and then include it using <script src = "">.
0
 
RoonaanCommented:
That's a good solution as well, although you might run into problem with non-js clients/visitors.

-r-
0
 
nltechCommented:
you could do it with a linked script that does a document write, but it wouldn't be visible to folks with scripting disabled in their browser.

you can 'include' files similar to your reference to C using server side scripting too.... this briefly describes the process in php (and asp)...
http://www.hardcoder.com/scripting/php/include_files.php

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now