Including an external html in html

Discussion in 'HTML & Website Design' started by simnorwebdesign, Jul 3, 2007.

  1. #1
    Hi, I want to add some code which is in HTML on all of the pages in my website, the only problem is when I change something in that code it'll mean that I have to change the code on every page, what I want to do is put the code in one file and then tell the HTML to read that code, I know about the <script> tags but you can only put them in the head, this code has to go in a cell of a table so it needs to be in the body.

    Can anyone help me
    Thank you
     
    simnorwebdesign, Jul 3, 2007 IP
  2. ninjamuk

    ninjamuk Peon

    Messages:
    305
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In my limited knowledge of coding practices, it sounds like you need a PHP include or something similar.
     
    ninjamuk, Jul 3, 2007 IP
  3. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #3
    There are several ways to do that.
    - Using SSI (Server Side Includes) on server side
    - Using a program to make your HTML on server side (PHP, PERL, ...)
    - Using AJAX on client side to refresh that cell
    - Using an IFRAME on your html as the content of that cell
    - ...

    If the change is on a table cell probably your best option is with IFRAME.
     
    ajsa52, Jul 3, 2007 IP
  4. myfrogger

    myfrogger Well-Known Member

    Messages:
    439
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    110
    #4
    I would highly recommend using PHP if this is a fairly large website. You'll be happy that you did. If you have less than a couple dozen pages, it is probably easier to just insert the extra code on every html page. (Easier if you don't have much knowledge of PHP like myself).
     
    myfrogger, Jul 3, 2007 IP
  5. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I suggest you read this post I wrote last year on the subject. Regardless of whether you know how to use PHP includes or Server Side Includes (SSI) you'll be able to learn enough to use them on your Web site (consider this to be the ultimate authority on PHP includes and SSI).

    http://forums.digitalpoint.com/showthread.php?p=2145250#post2145250
     
    Dan Schulz, Jul 3, 2007 IP
    simnorwebdesign likes this.
  6. Mxhub

    Mxhub Active Member

    Messages:
    474
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #6
    i suggest use php.

    main page in php

    use "include" to incorporate your html page.
     
    Mxhub, Jul 4, 2007 IP
  7. simnorwebdesign

    simnorwebdesign Peon

    Messages:
    595
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thank you all, you've been a real help, I will probably do the PHP thing some time today.
     
    simnorwebdesign, Jul 4, 2007 IP