One of my clients want a counter to use PHP inside of a HTML page but I don't think it's possible unless his server can support PHP use inside a *.html file ?

I might have to ask him to make the changes to his server config. How can you set this on an Apache server?

I want to ask him to check this. Can you check to see you can do this? phpinfo() ?

Thanks for your time, guys 🙂

    You can simply create a .htaccess file which allows HTML to be parsed as PHP or however the way i prefer is use mod_rewrite to have .php files and just make them look like html ones

    something like

    RewriteEngine on
    RewriteRule ^([a-z0-9_+]+)\.html$ $1.php [NC]
    

      I don't think that will work. I will want to 'include' the php file into the html page and I don't think it can be done usign that method without havign to constantly make changes to the .htaccess file

      The guy said this to me:

      I believe it can be done with the gd library.

      Surely all this isn't worth it for a lousy $5??

        Originally posted by Davy
        The guy said this to me: "I believe it can be done with the gd library."

        Have an <img> tag in the HTML page that links to a script. The script (using $_SERVER['HTTP_REFERER'] to find out which page was calling it) works out an appropriate value for the counter and constructs an appropriate image, which it then outputs under an appropriate Content-Type: header.

        Surely all this isn't worth it for a lousy $5??

        It surely isn't. Five dollars? If I were to go to meet with a client, five dollars probably wouldn't even meet the costs of the trip.

        And "hit counters" are so pass&eacute;....

          referencing the script through the <img> tag is what he originally suggested but I never heard of doing that before!

          I did, however, have the same thoughts on how the script was gonna run btw 😛

          ...Just didn't know how to go about putting it in the HTML page....

          Will have a go in a minute of doing that with a simple script and try doing the counter. It's an 'online' client so no travel expenses 😛 I'll just put the $5 to my web host as paypal donation for generously giving me free space with next to no limitations and no horrible domains 😃😃

          Thank you Weedpacket

            Ok I can get a script working easily enough it does exactly what I want it to do but I'm having a problem with referenceing the image source.

            I can get it to reference a single image but if a .php file has more then one images echo'd on it then it will show as a broken link. Is there a way I can merge the digit images together?

              Yeah; that's where the GD functions come in: you already have a collection of images one for each digit of course; what you need to do with them is use imagecreate or imagecreatetruecolor to - ah, (Weedpacket shrugs) create a new image 🙂 - and then imagecopy() the appropriate digits into place. Then you've only got the one single image to output, which after all is what the client is expecting from its request.

                Write a Reply...