Simple web page commenting via on-rev?
alex at tweedly.net
Sun Oct 30 11:17:00 EDT 2011
On 29/10/2011 20:43, Alex Tweedly wrote:
> I think the overall descriptive article is still there -
> though there is no detail about the comment system (and no code - I
> don't remember if it was ever available or not).
> -- Alex.
Replying to myself again ..... tsk. tsk.
Stephen is right - you don't have to go very far before you start
replicating work that revIgniter has already done. I do plan to switch
to using it - just as soon as I can get over the steep initial learning
In the meantime, I stripped down my own (rather convoluted) code for a
cmmenting system, to produce a VERY basic version - included below.
You can try it out at www.tweedly.org/comments/try.lc
> set the errormode to "inline"
> -- file name can be in either $_GET (initial request) or $_POST
> (comment submitted)
> put $_POST["which"] & $_GET["which"] into tWhich
> if tWhich is not empty then
> put URL ("file:" & tWhich) into tData
> if "comment" is among the keys of $_POST then
> put "@comment" && $_POST["user"] && the english date & CR after tData
> put $_POST["comment"] & CR after tData
> put "@endcomment" & CR after tData
> put tData into URL ("file:" & tWhich)
> end if
> repeat for each line L in tData
> switch word 1 of L
> case "@comment"
> put "<h2> Comment from " & word 2 to -1 of L & "</h2>" & cr
> case "@endcomment"
> put "<p>"
> put L
> end switch
> end repeat
> <form method='post' action='try.lc'><br>
> <input type='hidden' name='which' value='<?lc put tWhich?>'>
> User: <input type='text' name='user' size='40' value=''><br>
> Comment: <textarea name='comment' cols='40' rows='8'></textarea><br>
> <input type='submit' value='Comment' /><br>
> put the files into tFiles
> filter tFiles with "*.txt"
> repeat for each line L in tFiles
> put "<a href='try.lc?which=" & L & "'>" & L & "</a><br>" & CR
> end repeat
More information about the Use-livecode