How to add a php script to a html document?

Discussion in 'PHP' started by bigidea_guy, Aug 23, 2008.

  1. #1
    Is there an easy way to do it? the website is markspixel.com the script will be on the index page
     
    bigidea_guy, Aug 23, 2008 IP
  2. gameOn

    gameOn Member

    Messages:
    624
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    35
    #2
    Just rename the html file to php (Remember to make all " (doublequotes) to ' (singlequote),in that page ) and include the php script you want..

    hope that helps..
     
    gameOn, Aug 23, 2008 IP
  3. rcadble

    rcadble Peon

    Messages:
    109
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Looks like you don't very much about PHP, so your question is a bit confusing.

    You can embed PHP code onto any file with a .php or .phtml extension with the opening and closing tags
    <?php
        //code here
    ?>
    Code (markup):
    Alternatively, you can import another PHP script into your page using the following code:
    <?php
        include("file.php");
    ?>
    Code (markup):
    Since PHP files can contain HTML and PHP, and PHP is only parsed within the opening and closing tags, I recommend you make the page index.php instead of index.html, that way, you can embed php.
     
    rcadble, Aug 23, 2008 IP
    bigidea_guy likes this.
  4. bigidea_guy

    bigidea_guy Banned

    Messages:
    518
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks, I know a little php, and I tried some other stuff but it didn't work at all, the page would come up blank and stuff. this helped thanks
     
    bigidea_guy, Aug 23, 2008 IP
  5. Ilyes

    Ilyes Banned

    Messages:
    129
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ilyes, Aug 24, 2008 IP
  6. ash84

    ash84 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    you could also use .htaccess to make any html pages use the php engine, ill google around and post again
     
    ash84, Aug 24, 2008 IP
  7. ash84

    ash84 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    here, use this:
    www[dot]desilva[dot]biz/php/phpinhtml.html

    this may come in hand also:
    forums[dot]digitalpoint[dot]com/showthread.php?t=5801
     
    ash84, Aug 24, 2008 IP
  8. bigidea_guy

    bigidea_guy Banned

    Messages:
    518
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks, I got everything working now
     
    bigidea_guy, Aug 24, 2008 IP
  9. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    this would be a good way i have a php file that creats an image of text i just use htaccess to rename image.php to image.jpg then u can use it in html pages this should work for other php files :)
     
    cornetofreak, Aug 24, 2008 IP