Re: Wow! New CGIs

2009-04-17 Thread J. Landman Gay

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.
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Wow! New CGIs

2009-04-17 Thread Richard Gaskin

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 
native HTML.


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.


--
 Richard Gaskin
 Fourth World
 Revolution training and consulting: http://www.fourthworld.com
 Webzine for Rev developers: http://www.revjournal.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Wow! New CGIs

2009-04-16 Thread J. Landman Gay
This is too cool. I have an old Rev CGI example on my web site. It just 
picks a random line from a list of image files and displays the image in 
an iframe. It requires about 25 lines of script and two additional text 
files to do its work. The CGI loads an html template from a file, loads 
and reads a list of images from another text file, replaces markers in 
the template with a random line from the image list, and sends the whole 
business back to the browser. Thirty lines of script, two text files, 
and of course a folder of images -- and useless if the user's browser 
doesn't support iframes.


Now I can do it with one line of Rev script placed directly inside the 
web page itself. All I had to do was embed this in the page:


?rev
put img src=quotecgiphotos/  any line of url 
(file:cgiphotos.txt) quote 

?

Is that cool or what? I'm *very* excited about all this.

See it:  http://jacque.on-rev.com/index.irev

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Wow! New CGIs

2009-04-16 Thread Richard Gaskin

J. Landman Gay wrote:

This is too cool. I have an old Rev CGI example on my web site. It just 
picks a random line from a list of image files and displays the image in 
an iframe. It requires about 25 lines of script and two additional text 
files to do its work. The CGI loads an html template from a file, loads 
and reads a list of images from another text file, replaces markers in 
the template with a random line from the image list, and sends the whole 
business back to the browser. Thirty lines of script, two text files, 
and of course a folder of images -- and useless if the user's browser 
doesn't support iframes.


Now I can do it with one line of Rev script placed directly inside the 
web page itself. All I had to do was embed this in the page:


?rev
put img src=quotecgiphotos/  any line of url 
(file:cgiphotos.txt) quote 

?

Is that cool or what? I'm *very* excited about all this.


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:



-- cgi script:
put Content-Type: text/plain  cr  cr  \
merge(template.txt) crcr


-- template.txt:
This is an image: img src=?
return any line of url (file:cgiphotos.txt)
?


The merge function is an underrated powerhouse.

--
 Richard Gaskin
 Fourth World
 Revolution training and consulting: http://www.fourthworld.com
 Webzine for Rev developers: http://www.revjournal.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution