Page 1 of 1
cgi-related help needed
Posted: Mon Dec 07, 2009 8:05 pm
by shadowslash
Is there a nice list somewhere that displays all compatible commands, functions etc. with the Rev CGI with definitions? I've tried looking at the Dictionary included with Rev and also the online dictionary, on the online dictionary, it dims out the commands that aren't compatible with revServer. I took a look at it and saw that
launch or
launch URL seems to be supported by revServer. I tried it on mine but it just displayed a blank page. Is there a way to
launch an URL via CGI? And is there even a list as I described it above... More power guys and uhh, btw, my hosting is free....

Re: cgi-related help needed
Posted: Mon Dec 07, 2009 8:44 pm
by FourthWorld
I'm not sure what "launch url" would be expected to do on a server; most server processes are easily run with the "shell" function or "open process".
For example, here's a handler from my CGI library for sending email using the mail program normally installed on Linux servers:
Code: Select all
on cgiSendMail pTo, pFrom, pSubject, pMessage
put "/usr/sbin/sendmail -t" into tSendMailProg
open process tSendMailProg for write
write "From:" && pFrom & cr to process tSendMailProg
write "To:" && pTo & cr to process tSendMailProg
write "Subject:" && pSubject & cr & cr to process tSendMailProg
write pMessage & cr to process tSendMailProg
close process tSendMailProg
wait until tSendMailProg is not among the lines of the openProcesses
end cgiSendMail
To answer your larger question, most of the things you'd want to do with a CGI are supported, working with text, reading/writing files, arrays, etc. Things related to the GUI (windowShape, gradients, the "go" command, etc.) won't work because there's no GUI in the faceless server mode.
Tip: one of the cool things you can do with a CGI script is use libraries via the "start using" command. This makes it simple to write all manner of handy commands and functions that all of your CGIs can use over and over without having to copy them to each CGI script.
Re: cgi-related help needed
Posted: Wed Dec 09, 2009 4:56 pm
by shadowslash
Thanks for the prompt reply, I was thinking of the
launch url command as something that could hopefully open a new webpage without requiring the user to click on a link?
FourthWorld wrote:Tip: one of the cool things you can do with a CGI script is use libraries via the "start using" command. This makes it simple to write all manner of handy commands and functions that all of your CGIs can use over and over without having to copy them to each CGI script.
- and I use the
start using or the
library command on my CGI scripts and reference it to revStacks?
Re: cgi-related help needed
Posted: Wed Dec 09, 2009 5:25 pm
by FourthWorld
Yes, to include any stack as a library your CGI script calls it using the same syntax as in a standalone:
start using "MyLibrary.rev"
Note that the path there assumes the stack is in the same folder as the CGI. When a CGI runs, the defaultFolder is the folder in which the CGI resides. So if your library stack is in a subfolder named "libs", for example, you would use:
start using "/libs/MyLibrary.rev"
As for opening a new window, you can do that by setting the location with "_blank" in the target attribute. But remember how CGIs work as you plan your interface in the client: when a CGI is called, whatever it returns replaces the current page. If you want to keep your current page and have the results in a new window, you might add a target attribute to the link that calls the CGI. If you want to overwrite only a portion of the page, you might consider putting that portion in an iFrame, as I did at mumblo.com.