REBOL [ Title: "CGI Web Page Comment Poster" Date: 14-Sep-1999 File: %cgicomment.r Author: "Carl Sassenrath" Purpose: {Allows viewers to add comments to a web page. (needs webcomment.r to create example forms file).} Note: { For each article, in the comment posting form, be sure to modify the hidden "file" field value to give it the correct name of the HTML file to receive the comments. Also, the HTML file must have an HTML comment to note where the table insertion is made. See comments below. } library: [ level: 'intermediate platform: none type: 'tutorial domain: [cgi other-net markup] tested-under: none support: none license: none see-also: none ] ] ;-- Output HTTP header first, just in case an error occurs ; the user will be able to see it and report it to you. print "Content-Type: text/html^/" ;-- Uncomment this line for debugging purposes: ;print system/options/cgi/query-string ;-- A function which creates the HTML used for the comments ; table. It was created in a visual editor and pasted here. ; Note that everything except the variables of the function ; must be written as a tag or as a string. When called ; this function creates the table row and returns it as text. make-comment: func [from date comment] [ reform [
"From:"
"Comment:"
" cgi/comment]][cgi/comment] ;-- Read the HTML file, add the newest comment to it, and write ; it out. An HTML comment is used to mark where it goes. page: read file insert find page new-comment write file page ;-- Display the page again: print page