Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] [ANN] working example - standard message function library

From: norsepower::uswest::net at: 8-Feb-2001 14:24

The Standard Message Function Library has been updated at http:// www.dangeroustechnology.com/standard-message-function-library.txt The Standard Message Dialect uses the library plus two short .cgi scripts (create-message.cgi and display-messages.cgi), a configuration-file.r and a cascading stylesheet to run an entire news site. The two .cgi scripts handle the input/output of message creation for all types of messages, including news, comments, classified, forums, etc. -------------------- To create a message, you pass author, subject, content, and messageType variables to create-message.cgi. Following is create-message.cgi: #!rebol -cs REBOL [] do load %standard-message-function-library.r cgi-input: retrieve-user-data create-message/from-cgi cgi-input -------------------- To display messages, you pass messageType and messageID variables to display- messages.cgi. Following is display-messages.cgi: #!rebol -cs REBOL [] do load %standard-message-function-library.r cgi-input: retrieve-user-data do load %configuration-file.r stylesheet: read %stylesheet.html print "Content-Type: text/html^/" print html-page-header print stylesheet print pre-messages display-messages cgi-input print post-messages -------------------- That's it. All messages are saved as XML and displayed as CSS-HTML. To view a working example, go to http://test.fargonews.com It's a little bit ugly because of the short, redundant messages, but you get the concept. When you visit http://test.fargonews.com, REBOL executes an index.cgi script which simply passes messageType and messageID variables to display-messages.cgi. The site can further be expanded by creating directories of message data in XML for /classified , /comments , etc. The type of messages displayed depends on messageType. A separate stylesheet can be called for separate messageType variables. You can display a specific message by sending a valid messageID instead of none to the script. You can view a message creation form by logging in using username1 and password1 at http://test.fargonews.com/login.html Your login is verified and encrypted using REBOL (thanks to %encrypt.r by Bohdan Lechnowsky) and you are taken to a message creation form (built dynamically upon login validation.) After you submit your message, it will appear at the bottom of the page at http://test.fargonews.com As always, your input is appreciated. -Ryan