How Could I include php in html files ?

Discussion in 'PHP' started by brokensoft, Dec 20, 2006.

  1. #1
    How Could I include php in html files ?

    i have html files. i want to add header and footer to it.

    i try :

    <?PHP 
    include("header.php"); 
    ?> 
    PHP:
    but it didnot work.
     
    brokensoft, Dec 20, 2006 IP
  2. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #2
    You would need to set HTML pages to be parsed by the PHP parser, then you would include the PHP code within the HTML as you would normally:

    <?

    phpcode;

    ?>
     
    Richie_Ni, Dec 20, 2006 IP
  3. jnm

    jnm Guest

    Messages:
    343
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    create an .htaccess file and add this line to it:

    AddType application/x-httpd-php .php .html .htm
     
    jnm, Dec 20, 2006 IP
  4. brokensoft

    brokensoft Active Member

    Messages:
    214
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #4
    thanks jnm
    it is work now :)
     
    brokensoft, Dec 20, 2006 IP
  5. benjamin.johnstone1

    benjamin.johnstone1 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I had a hard time with this until I realized that I had to phrase it like this because I am using php 5:

    AddHandler application/x-httpd-php5 .html.

    I almost gave up, I hope this helps someone.
     
    benjamin.johnstone1, Jul 17, 2011 IP