The LiveCode server-side scripting technology allows you to mix LiveCode code with HTML content on the same web page, in much the same way as PHP, the most widely-used server-side scripting language. The advantage for LiveCode developers is that they can use the very same language they use to develop desktop applications to create dynamic web pages or web server output. While the language is the same there are a few differences and additions to LiveCode as used in server-side scripting, compared to the way it is used in developing stacks. Here is a summary of the main differences:
put
command without a destination container, such as put "Hello World"
, is directed to the message box. There is no message box in the server-side environment; instead a put
without a destination is returned directly to the client requesting the script's output. If that client is a a web browser, for instance, the script's output is rendered as a web page. If the requestor is an application, the output of the LC Server script is returned directly to that application.the defaultFolder
and the itemDelimiter
;
put
data into
are variables and files on the server.include
statement, or in a library stack in use by the .lc file. There is no concept of the message path as in the LiveCode desktop environment.include
command – In addition to external library stacks, you can also attach other .lc and .html files to your .lc file with the include
command. These can contain frequently used handlers that your .lc script can use as if they were part of the current file. For example, say we have a file containing frequently used handlers called "mylibrary.lc" in the same folder as your current .lc file. It could contain our old friend the q()
function, which returns a string with double quotes around it. We could do this in our .lc file:
include "mylibrary.lc" put "<p>" & q("Hello World") & "</p>"
$_GET
and $_POST
array variables – When a form on a web page is submitted to the .lc script, or a URL with a query string is requested, the LiveCode Server engine will attempt to parse this data into structured arrays. For a query string, or a form 'GET' method, this information will placed in the $_GET array. For a form 'POST' method, this information will be placed in the $_POST array. In both cases the conversion to an array is the same. The incoming data is a set of key=value pairs. The key determines which element of the array the value is put into.$_SERVER
array variable - contains lots of information about the client and server environments. See an example here.the errormode
property set the errormode to "inline" - displays LiveCode scripting errors in the web page; good for debugging (remember to comment out before you go final on your page.)http://samples.on-rev.com – Do Intro through Database
An Unofficial Guide to LiveCode Server - Created by Simon Smith at activethought.net
http://samples.on-rev.com/ – RunRev's On-rev sample page.
http://www.troz.net/onrev/ – Rev developer Sarah Reichelt's examples, plus links to a bunch of other on-rev sites.
http://splash21.on-rev.com/ – Some very nice, sophisticated things done by a web professional.
http://dev.on-rev.com – Some simple examples by Devin Asay.
http://www.jacque.on-rev.com – Jacqueline Landman Gay's on-rev and revlet samples, including a fun Mad-libs page.