CGI tutorial for denser than dummy

Lars Lewejohann lale at phenotyping.com
Sat Jul 26 04:49:00 EDT 2003


Hi James,

The CGI stuff is badly neglected. Here are some
resources (you might have already come across):

http://www.runrev.com/revolution/developers/articles/tipoftheweek/6.html
http://www.navaching.com/pagem.html

Here is simple cgi-stack doing an image rotation. (You can see it at work
at http://www.diereini.de ). This cgi is quite similar to the first example
from the "tip of the week" but instead of copying the image to a new file
it generates html output with a random picture. I submitted this three 
weeks
ago to the runrev user-contributions, but they didn't take it. Well, it 
might be
to simple for inclusion on their site...

Cut here and paste it to a texteditor and save it in UNIX mode-->
#!Linux --This assumes that you downloaded the LINUX engine and placed 
it into your cgi-bin folder
--A simple image rotation cgi
--This stack assumes that you have a domain with a tree structure like:
--/cgi-bin (your CGIs and the RR engine)
--/images/rotation (your pictures for rotation)
--save this file (in UNIX mode!) as "rotation.cgi" to your "cgi-bin"
--CHMOD the "rotation.cgi" to 755 (="-rwxr-xr-x")
--in your browser type "http://www.yourdomain.com/cgi-bin/rotation.cgi"
--Have fun! Lars Lewejohann

 
on startup
 set the defaultFolder to "../images/rotation" --prior to this the 
default folder was (..)/cgi-bin
 put the files into myContents  --now all image names are stored into 
"myContents"
 set the itemDelimiter to " "   --contents of "myContents" are separated 
by a blank...
--now make path to a random pict:
 put "http://www.yourdomain.com/images/rotation/" & any line of 
myContents into ARandomPict
--now prepare the html-code for output and store it into "buffer":
 put "<html><head><title>Title of your page</title></head><body 
bgcolor=" &QUOTE &"#ffff99" &QUOTE  &"><div align=" &QUOTE &"center" 
&QUOTE &">" after buffer
 put "<img src=" &QUOTE &ARandomPict &QUOTE &">" after buffer
 put "</div></body></html>" after buffer
--write the contents via the put function
 put "Content-Type: text/html" & cr
 put "Content-Length:" && the length of buffer & cr & cr
 put buffer
end startup
<--end cut here

Hope that helps.

Kind regards,

Lars

James Lewes wrote:

> Has anybody on the list go a cgi tutorial for denser than dummy.
>
> James
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list