how to *include* a file in an html page?

Discussion in 'ASP General' started by cooldv, Dec 27, 2003.

  1. cooldv

    cooldv Guest

    i have many *.html* pages with the same header. i wanted to make one
    *header* file and put a link to that file in all html pages. So if i
    ever need to make changes in the header, i will need to edit only 1
    file rather than all pages.

    for *.asp* pages this code works fine:-

    <!-- #include file="filename.inc" -->


    but the same **include** does not work for *.html* pages. i guess
    there is some other way to put a link!
    any help appreciated
    cooldv, Dec 27, 2003
    #1
    1. Advertising

  2. cooldv

    Steven Burn Guest

    You can use an iFrame, however, I would not reccomend it as it is a little
    "cluttery" to say the least.

    You'd be best off converting your pages to .ASP and using the #include tag.

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    cooldv <> wrote in message
    news:...
    > i have many *.html* pages with the same header. i wanted to make one
    > *header* file and put a link to that file in all html pages. So if i
    > ever need to make changes in the header, i will need to edit only 1
    > file rather than all pages.
    >
    > for *.asp* pages this code works fine:-
    >
    > <!-- #include file="filename.inc" -->
    >
    >
    > but the same **include** does not work for *.html* pages. i guess
    > there is some other way to put a link!
    > any help appreciated
    Steven Burn, Dec 27, 2003
    #2
    1. Advertising

  3. Tell IIS to treat .html extension as ASP files.



    "cooldv" <> wrote in message
    news:...
    > i have many *.html* pages with the same header. i wanted to make one
    > *header* file and put a link to that file in all html pages. So if i
    > ever need to make changes in the header, i will need to edit only 1
    > file rather than all pages.
    >
    > for *.asp* pages this code works fine:-
    >
    > <!-- #include file="filename.inc" -->
    >
    >
    > but the same **include** does not work for *.html* pages. i guess
    > there is some other way to put a link!
    > any help appreciated
    freaky friday, Dec 27, 2003
    #3
  4. cooldv

    Guest Guest

    You need SSI (Server Side Includes) in some shape.
    It depends in the server type (mainly Windows/IIS or Unix/Apache) as well as
    on its settings.
    You have to ask your ISP.
    If they do not support ASP they might support shtml extentions which allow
    SSI. The include syntax should be the same as in ASP, but you better check
    it at, say
    http://www.webcom.com/~webcom/help/inc/include.shtml

    Alternatively, if you do noit want to change the files extention you can put
    the headings into .js files and output then using Javascript

    Yet the cleanest way is, as Steven suggested, switch to ASP (or to PHP if
    you are in Apache)

    "cooldv" <> wrote in message
    news:...
    > i have many *.html* pages with the same header. i wanted to make one
    > *header* file and put a link to that file in all html pages. So if i
    > ever need to make changes in the header, i will need to edit only 1
    > file rather than all pages.
    >
    > for *.asp* pages this code works fine:-
    >
    > <!-- #include file="filename.inc" -->
    >
    >
    > but the same **include** does not work for *.html* pages. i guess
    > there is some other way to put a link!
    > any help appreciated
    Guest, Dec 27, 2003
    #4
  5. cooldv

    Jeff Cochran Guest

    On 27 Dec 2003 08:13:02 -0800, (cooldv) wrote:

    >i have many *.html* pages with the same header. i wanted to make one
    >*header* file and put a link to that file in all html pages. So if i
    >ever need to make changes in the header, i will need to edit only 1
    >file rather than all pages.
    >
    >for *.asp* pages this code works fine:-
    >
    > <!-- #include file="filename.inc" -->
    >
    >
    >but the same **include** does not work for *.html* pages. i guess
    >there is some other way to put a link!


    Okay, I may be stating the obvious, but of course ASP code won't work
    in an HTML file. Either rename the HTML file with the ASP extension,
    alter IIS to process all HTML extensions as ASP (App Mappings - Dumb
    way to do it...), or use SSI and include the file in your HTML code.
    You'll need to use a SHTM/SHTML extension to process SSI in IIS, so
    you might as well rename the files with an ASP extension to begin
    with.

    Jeff
    Jeff Cochran, Dec 29, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cloud Burst
    Replies:
    11
    Views:
    1,024
  2. Victor Bazarov

    #include "file" -vs- #include <file>

    Victor Bazarov, Mar 5, 2005, in forum: C++
    Replies:
    4
    Views:
    534
    Exits Funnel
    Mar 6, 2005
  3. Tom
    Replies:
    8
    Views:
    668
    Adrienne Boswell
    Feb 13, 2007
  4. PTM
    Replies:
    1
    Views:
    329
    Andy Dingley
    Nov 12, 2007
  5. Andreas Bogenberger
    Replies:
    3
    Views:
    903
    Andreas Bogenberger
    Feb 22, 2008
Loading...

Share This Page