Include an HTML file in PHP

Discussion in 'PHP' started by MaverickMoney, Oct 31, 2009.

  1. #1
    My PHP coding is a little scratchy, so I apologize for the what might seem easy answer.

    I want a PHP page to pull the information from an HTML file (or PHP file that can show HTML).

    The file will hold advertising information and I'd like to call it different times in my PHP pages. If I were to change my advertising I would like to change it in one location, rather than many.

    All help is appreciated.

    Thanks!
     
    MaverickMoney, Oct 31, 2009 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    hi

    <?

    include 'sidebar.html';
    ?>

    in the php file use this assumes html file name is sidebar.html

    Regards

    Alex
     
    kmap, Oct 31, 2009 IP
  3. MaverickMoney

    MaverickMoney Active Member

    Messages:
    519
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Thanks this helps :)
     
    MaverickMoney, Oct 31, 2009 IP
  4. Scripts man

    Scripts man Guest

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The Difference between HTML and PHP
    jooria.com/Tutorials/Website-Programming-16/The-Difference-between-HTML-and-PHP-63/index.html
    this will help you
     
    Scripts man, Nov 1, 2009 IP
  5. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I don't think its appropriate to use include for an HTML file...

    many reasons:
    INJECTIONS!
    ...need more? have you site hacked once, you learn quick.

    Use:

    read()

    or file_get_contents.

    Note: this is only good if you're including ONLY html/txt/non-php

    Either way, try that instead.
     
    NatalicWolf, Nov 1, 2009 IP