Tags:
create new tag
, view all tags

Question

Can I use the spreadsheet plugin to do calculations within the comment plugin template?

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories:  

-- CarlMcKinney - 06 Sep 2006

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list 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

 
Change status to:
Topic revision: r4 - 2006-09-14 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.