Re: CGI?
Re: CGI?
- Subject: Re: CGI?
- From: cris <email@hidden>
- Date: Fri, 13 Apr 2001 00:31:24 +0200
on 12.04.2001 20:00 Uhr, Michelle Steiner at email@hidden wrote:
>
I'm trying to write a CGI to display a counter in a web page. This is
>
the script I've written:
>
(...)
>
>
Now, what do I have to do in order to get the number to display in the
>
web page? I'm using Claris Home Page to write the HTML and am using
>
Personal Web Sharing to publish the page.
Open the standard additions and look at the 'handle CGI request' under
'Internet suite'.
If you just want to have a counter you can ignore all the optional
parameters and just put your script code into the handler.
At the end of the handler you have to return back something to the webserver
(which will pass it to the browser). You need to specify the type of
response in the header. In this case it will be a '200 OK' which looks so:
property CRLF : (ASCII character 13) & (ASCII character 10)
property http_OK_header : "HTTP/1.0 200 OK" & CRLF & "Server: MacHTTP" &
CRLF & "MIME-Version: 1.0" & CRLF & "Content-type: text/html" & CRLF & CRLF
With this, you just say the browser "hey, here comes a normal HTML page" and
the browser will interpret it and displays it. Another response type could
be a redirect, blah....
After the header you can put plain HTML. It is up to you how you combine
your static page with the dynamic counter part (i would read the static page
into a variable and parse the counter into it).
The full response would then look so:
return http_OK_header & myStaticPagePart1 & myCounterValue &
myStaticPagePart2
Resources:
http://www.comvista.com/lessons/START_HERE.html
Ignore the recommended Scripting Additions for parsing CGI arguments (if you
ever need that) and use 'MT parse CGI' from Tanakas OSAX instead:
http://mtlab.ecn.fpu.ac.jp/scripting/Jcode_osax.html
Greetings
cris
--
English is my second language.
www.cooc.de
References: | |
| >CGI? (From: Michelle Steiner <email@hidden>) |