Making the move...
Mark Waddingham
36degrees at runrev.com
Tue Mar 28 05:40:08 EST 2006
HI Dan,
I think the piece of the puzzle missing here is that of the web-
server. It is easy to configure Apache (for example) to execute a
particular program server-side when a page is requested that has a
specific extension. This program is passed both the requested URL and
resolved server-side path through the standard CGI environment
variables PATH_INFO and PATH_TRANSLATED.
For example, when put in the appropriate place something like:
AddHandler rev_html .revhtml
Action rev_html /cgi-bin/process_revhtml.cgi
Will tell Apache to execute /cgi-bin/process_revhtml.cgi everytime a
page with the extension .revhtml is accessed. (I wouldn't be
surprised if this is how Ruby-on-Rails is actually configured, and is
certainly how PHP or Perl is configured in some web-hosting
environments where they didn't want to use mod_perl or mod_php for
some reason).
The process_revhtml.cgi script can then be something like:
#! revolution -ui
on startup
local tInputScript
put url ("file:" & $PATH_TRANSLATED) into tInputScript
local tOutputScript
put merge(tInputScript) into tOutputScript
write "Content-Type: text/html" & return to stdout
write "Context-Length: " & the length of tOutputScript & return to
stdout
write return to stdout
write tOutputScript to stdout
end startup
So, a file on the webserver server such as 'current_time.revhtml'
containing the following:
<html>
<head>
<title>Current Server Time</title>
</head>
<body>
The current server time is [[the internet date]]
</body>
</html>
Will serve a page saying something like:
The current server time is Tue, 28 Mar 2006 10:55:01 +0000
Of course, this is an incredibly simplistic example - but one that
can be extended in a number of ways. Indeed, from this it is not hard
to see how you could start to create an entire environment in
which .revhtml scripts are run giving various features akin to PHP,
Perl (with all its modules) and Ruby-on-Rails.
Warmest Regards,
Mark.
------------------------------------------------------------------
Mark Waddingham ~ 36degrees at runrev.com ~ http://www.runrev.com
Runtime Revolution ~ User-Centric Development Tools
More information about the use-livecode
mailing list