#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    35
    Rep Power
    14
    I want a count file(PHP) to be executed when a HTML file requested.
    How can I do this? I have no idea about excuted a PHP file inside a HTML file.

    [This message has been edited by xiaoguiwxd (edited September 18, 2000).]
  2. #2
  3. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Well, technically you can't.

    Unless the server is set to parse .htm/.html as PHP documents.

    Essentially it works the other way.

    You write html in your php document.

    as for writing a counter script, they are rather simple. To execute your php counter script you'd want to use either a require() or include() function.

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,640
    Rep Power
    4476
    Another question on this subject. What if you use SSI, server side includes, for a php file. Is it parsed then, or just plopped in as text?

    Thanks.

    ---JH
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Newark, DE, USA
    Posts
    39
    Rep Power
    14
    If you set up your web server to parse .html documents for php code (the <?php ?> tags) then you'll be able to use php code within .html documents. With the apache web server, add .html to the dirctive in httpd.conf which instructions the web server to parse documents for php code:
    AddType application/x-httpd-php .php .html

    You could also just use .php (or .php3, .phtml, etc) documents instead of .html documents.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by xiaoguiwxd:
    I want a count file(PHP) to be executed when a HTML file requested.
    How can I do this? I have no idea about excuted a PHP file inside a HTML file.

    [This message has been edited by xiaoguiwxd (edited September 18, 2000).]
    [/quote]

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    35
    Rep Power
    14
    My friend told me that I can.
    Just insert:

    <img src="my_counter_script.php" width=0 height=0>

    into my HTML file.

    I tried it and it worked well. But I thought it was a weird solution.

    [This message has been edited by xiaoguiwxd (edited September 18, 2000).]
  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    <img src="my_counter_script.php" width=0 height=0>
    >>

    Yea, It will work well if your 'my_counter_script.php' is returing a image header.
    ie(header("Content-type: image/gif")).


    <<
    But I thought it was a weird solution
    >>

    No,,, you can carry on with same solution..other wise you need to use SSI for including your counter.



    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  12. #7
  13. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by SepodatiCreations:
    Another question on this subject. What if you use SSI, server side includes, for a php file. Is it parsed then, or just plopped in as text?

    Thanks.

    ---JH
    [/quote]

    No, you can not, again these are completely separate animals, and the server can not parse the same document with different externals, but you don't really need SSI when you can run PHP include() and PHP require(), as they are Including and Requiring the external PHP scripts or documents.



    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. header/footer in html (each page) just like word file
    By nihaarika2002 in forum HTML Programming
    Replies: 4
    Last Post: April 12th, 2004, 12:51 PM
  2. Replies: 3
    Last Post: February 17th, 2004, 10:08 AM
  3. PHP scripts to run in Javascript continuously
    By linhardt in forum JavaScript Development
    Replies: 0
    Last Post: February 13th, 2004, 02:51 PM
  4. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 07:42 PM
  5. javascript inside php tags
    By andy123 in forum JavaScript Development
    Replies: 5
    Last Post: February 5th, 2004, 04:34 PM

IMN logo majestic logo threadwatch logo seochat tools logo