You don’t need any of those. If you can get a basic AppleScript CGI working, then this is all you need to do: create a new CGI that accepts the data from a form (the comment and the user name, for instance), read a static HTML page, search and replace a marker with the new input, and save the static page. For instance, have a form that looks something like this:
<html>
<head>
<title>Add Your Comment!</title>
</head>
<body>
<center>
<form action="/cgi-bin/comment.cgi" method=post>
Name: <input type="text" name="the_name" value="" size="35" maxlength="60"><br>
<textarea name="the_comment" rows="10" cols="40">Enter your comment here...</textarea><br>
<input type=submit name=Submit value="Add Your Comment">
</form>
</center>
</body>
</html>
Then have a static “comments.html” page like this:
<html>
<head>
<title>Comments</title>
</head>
<body>
<H1>Comments</H1>
<!-- marker -->
</body>
</html>
Then, your CGI would look something like this (I don’t remember exactly how the “handle CGI” handler was formatted or how the arguments were extracted, I haven’t done this in a few years, but if you’ve got the email CGI working, then this should be a snap):
property comments_file : "path:to:comments.html"
property crlf : (ASCII character 13) & (ASCII character 10)
property http_header : "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
on handle CGI request path_args
--parse your CGI stuff here to extract the_comment & the_name
set the_string to (read file comments_file)
set search_string to "<!-- marker -->"
set replace_string to "<hr>" & return & "<p>" & the_comment & "<br>" & return & "<i>posted by " & the_name & " on " & ((current date) as string) & "</i></p>" & return & "<!-- marker -->"
set the_string to (my snr(the_string, search_string, replace_string))
my write_to_file(comments_file, the_string, false)
return http_header & "Comment added, go to <a href=\"../comments.html\">comments page</a>."
end handle CGI request
on snr(the_string, search_string, replace_string)
set old_delim to AppleScript's text item delimiters
set AppleScript's text item delimiters to search_string
set the_string to text items of the_string
set AppleScript's text item delimiters to replace_string
set the_string to the_string as string
set AppleScript's text item delimiters to old_delim
return the_string
end snr
on write_to_file(the_file, the_string, with_appending)
set the_file to the_file as file specification
try
open for access the_file with write permission
if with_appending = false then set eof of the_file to 0
write (the_string as text) to the_file starting at eof
close access the_file
on error
try
close access the_file
end try
end try
end write_to_file
Be sure to update all the paths.
Again, it’s been a while since I’ve done this (and I can’t test it) but I don’t see why this wouldn’t work.
Jon