Wow! New CGIs
ambassador at fourthworld.com
Fri Apr 17 13:04:02 EDT 2009
J. Landman Gay wrote:
> Richard Gaskin wrote:
>> The new server package is very cool, esp. the live debugging, but FWIW
>> you can do that script with the old CGI with just two lines, one in the
>> CGI and one in a web page template:
> Ah, but with the new way there is nothing to merge; you don't need a
> template file at all. My cgi-bin folder is empty, because I don't need a
> separate CGI script either. Truly, all I needed to do was insert that
> one line into my web page and drop in a text file of listed images. If
> my list weren't so long, I'd not even use the text file, I'd just list
> the images directly in the web page as a variable. That way I wouldn't
> need any additional files at all.
> It really is cool.
Indeed it is. No question there. Even saving a couple steps is a good
move forward, and the debugger is a wonderful enhancement.
But to be clear, it's not that you don't need a web template; what you
don't need is the CGI script, since as a module that happens automatically.
The .irev file is effectively your template page, as it is in PHP. You
put any HTML into it, and without any embedded directives for the engine
that's what gets returned to the user. But with directives, the
engine processes those and returns the processed data back to the user.
The directives are sort of placeholders for executable code and
function calls, leaving everything outside of the directives intact as
This handling of web templates is very similar with both the new Apache
module and with the CGI engine using the merge function. The main
difference in this case (and there are others) is the convenience:
With a CGI, you need a script to grab whatever template pages you want
to use, run them through the merge function, and return the result to
the client. It need only be one line, as in my earlier example, but it
still needs to be there to run the merge.
With the Apache module, the server is preconfigured to hand off any file
request with a specific file name extension (e.g., ".irev" or ".php") to
an engine assigned to handle that file type. That engine processes
whatever engine-specific directives may be in the file, and returns it
to the client.
In both cases, there's a template page which combines HTML with
engine-specific directives; with Rev those are inside of either "<?" and
"?>" tags or "[[" and "]]" tags.
What you don't need to handle is the CGI to pick up that template and
process it, since that's preconfigured with the module.
Another nicety with the new module is that directives between "<?" and
"?>" tags don't need to have the keyword "return" in front, providing a
bit more graceful appearance.
Revolution training and consulting: http://www.fourthworld.com
Webzine for Rev developers: http://www.revjournal.com
More information about the use-livecode