Linking to html source docs

Posted on 2006-05-08
Last Modified: 2010-04-09
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?  
Question by:chsalvia
    LVL 49

    Accepted Solution

    If your server support serverside includes you could try:

         <!--#include virtual="header.html"-->
         page content
         <!--#include virtual="footer.html"-->


    Author Comment

    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 = "">.
    LVL 49

    Expert Comment

    That's a good solution as well, although you might run into problem with non-js clients/visitors.

    LVL 14

    Assisted Solution

    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)...


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now