On 29/10/2011 20:43, Alex Tweedly wrote:
I think the overall descriptive article is still there - http://andregarzia.com/page/bootstrappingacms 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 curve.

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

<?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
       break
    case "@endcomment"
       put "<p>"
       break
    default
       put L
       break
    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>
</form>

<?lc
else

  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

  ?>

-- Alex.


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to