Including PHP in my html. I'm new in PHP.

Discussion in 'PHP' started by woggy, May 21, 2006.

  1. #1
    Hi!

    I'm just into PHP - so excuse my n00b-question(s) to come.

    When trying to include a script in my HTML, I'm being told to just include f.x. this in my index.html:
    <?php include("shoutbox/shoutbox.php"); ?>

    within the <body>-field.

    And then, when I upload the shoutbox-folder and shoutbox.php, and the index.html and try to access index.html, my shoutbox doesn't show.

    Do I have to include anything in the <head>-tab ? Or what am I doing wrong?
     
    woggy, May 21, 2006 IP
  2. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #2
    index.html must be named index.php (or you can find a server directive that processes all html as php.... but it will just be easier for now to rename the file)
     
    TheHoff, May 21, 2006 IP
  3. woggy

    woggy Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Oh.. :eek: Thanks a lot!
    That worked!

    I'm in the early days of learning this all by my self, so maybe I'm coming back with some more (silly) questions.
     
    woggy, May 21, 2006 IP
  4. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No worries; good luck with it!
     
    TheHoff, May 21, 2006 IP
  5. PinoyIto

    PinoyIto Notable Member

    Messages:
    5,863
    Likes Received:
    170
    Best Answers:
    0
    Trophy Points:
    260
    #5
    If you want your php code work in .html file you can add the following code in your .htaccess file if supported by your server.

    AddType application/x-httpd-php .php .htm .html
     
    PinoyIto, May 22, 2006 IP