Question
Can I use the spreadsheet plugin to do calculations within the comment plugin template?
Environment
--
CarlMcKinney - 06 Sep 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
I have not tried it out, but CALC
should basically work on the output template. Let us know how it works out.
--
PeterThoeny - 09 Sep 2006
It does work! Just took a little effort to figure out the syntax. The template below creates a heading with time/author and a snip (80 characters) of the comment that can be used in TOCS:
%TMPL:DEF{PROMPT:tocteaser}%
<b>Comment:</b><br><textarea %DISABLED% rows="%rows|3%" cols="%cols|50%" name="comment_text" wrap="soft" onfocus="if(this.value=='%MESSAGE%')this.value=''" onblur="if(this.value=='')this.value='%MESSAGE%'">%MESSAGE%</textarea> <br /><input %DISABLED% type="submit" value="%button|Add Comment%" /> <hr width="90%" />
%TMPL:END%
%TMPL:DEF{OUTPUT:tocteaser}%
%CALC{"$SET(comment_text, %URLPARAM{"comment_text"}%)"}%
%CALC{"$SET(length, $EVAL($LENGTH($GET(comment_text) ) - 80 ) )"}%
%POS:BEFORE%---++++++ On %SERVERTIME{"$day $mon $year at $hour:$min"}%, %WIKIUSERNAME% wrote: %CALC{"$REPLACE($GET(comment_text) , 80, $GET(length), ...)"}%
%POS:BEFORE%%URLPARAM{"comment_text" }%
%POS:BEFORE%
%TMPL:END%
--
CarlMcKinney - 14 Sep 2006
Glad it worked out. Thanks for sharing...
--
PeterThoeny - 14 Sep 2006