PHP in HTML, works fine as PHP but not as HTML

Discussion in 'PHP' started by swmidirectory, Jul 28, 2005.

  1. #1
    I need some assistance using a PHP include in HTML, works fine as PHP but doesn't as HTML.

    What I'm trying to insert is this:

    <?php include "image.php"; ?>

    On my PHP test version, it works just fine, but on my HTML test version it doesn't ... the only difference is the file extension ".php" vs ".html" -- the coding is identical.

    http://www.swmidirectory.org/index2.html

    http://www.swmidirectory.org/index2.php

    All this is intended to do is display a random image underneath "Welcome to the Award Winning Southwest Michigan Business & Tourism Directory".

    My goal is to avoid using Javascripts to accomplish the loading of random images.

    Thanks in advance.
     
    swmidirectory, Jul 28, 2005 IP
  2. LGRComp

    LGRComp Well-Known Member

    Messages:
    516
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    195
    #2
    Is the web server set up to process .html as a php file? If not then of course it will not work. If it is apache you can create a .htaccess file to tell apache to process the .html file as a php file.

    From: http://forums.digitalpoint.com/showthread.php?p=186832#post186832
     
    LGRComp, Jul 28, 2005 IP
  3. anjanesh

    anjanesh Well-Known Member

    Messages:
    344
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    165
    #3
    LGRComp - wouldnt we able to change this in the Control Panel like CPanel, Plesk, DA etc ?

    Thanks
     
    anjanesh, Jul 28, 2005 IP
  4. LGRComp

    LGRComp Well-Known Member

    Messages:
    516
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    195
    #4
    I know you can add that in cPanel. I do not know Plesk and DA as well, but I imagine you can do it in them as well.
     
    LGRComp, Jul 28, 2005 IP
  5. swmidirectory

    swmidirectory Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    This was a simple correction ... thanks to LGRComp!

    Now I just need to fine tune some of the code.
     
    swmidirectory, Jul 31, 2005 IP
  6. LGRComp

    LGRComp Well-Known Member

    Messages:
    516
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    195
    #6
    Thanks for the compliment. Nice to know it helped.
     
    LGRComp, Jul 31, 2005 IP
  7. yabsoft

    yabsoft Active Member

    Messages:
    118
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #7
    it is easy to add handler in Cpanel!
     
    yabsoft, Aug 2, 2005 IP