[Tutor] Re: Hit Counter

Charlie Clark Charlie Clark <charlie@begeistert.org>
Thu, 02 Aug 2001 20:53:46 +0200

>Thanks for the responses so far. I've made some changes, but
>so far haven't resolved the problem. I've added the line
><!--#exec cgi="cgi-bin/counter.pyw"-->
>to my Web page, which by the looks of it, should execute the
>script each time I load the Web page. It's only running when
>I the script page. Can anybody see why this is?
This won't work. You can't get a web page to do any work as HTML doesn't have 
any commands.
<!-- whatever you want --> is just a comment in HTML which means it *won't* 
be interpreted by anything at all!

You've got two choices: either turn the page itself into a script (save it as 
.cgi and in the appropriate directory) in which case it will call other 
scripts *or* call the script via a trick such as <img src = "/cgi-bin/
counter.py">. The general advice is against ".pyw" as this won't necessarily 
work if you move the script to another computer.

Is your webserver configured to run Python files? Does "/cgi-bin/counter.pyw" 
work in your browser?

Charlie Clark
Helmholtzstr. 20
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-463-6199