Decent Blogging using TWiki

Function: RenderBlogComment

Render a single BlogComment

Note, the use of hardcoded rights in REDDOT{grant="..."} in the "format" section below as long as the RedDotPlugin does not support TWikiGroups natively. Replace it with your main BlogAuthor or remove the grant="..." completely to allow guests to get reddots to their comments.

see also: RenderDocNavigation

Parameters

Implementation

Main

%STARTINCLUDE%
%~~ DBCALL{"RenderDocNavigation" 
~~~   NAME="%NAME%" 
~~~   WHERE="BlogRef='%DBQUERY{topic="%NAME%" format="$formfield(BlogRef)"}%'"
~~~   ORDER="created"
~~~ }%
%~~ DBQUERY{topic="%NAME%" 
~~~  format="
*~~     <div class=\"blogRef\">
~~~     %STOPALIASAREA%$n<noautolink>
~~~        <h3>On 
~~~            <a href=\"$percntSCRIPTURL{\"view\"}$percnt/$web/$expand(BaseRef)\" 
~~~              title=\"permalink to <nop>$expand(BaseRef)\">
~~~              \"$expand(@BaseRef.Headline or BaseRef)\"
~~~              <span class=\"blogDate\">
~~~                ($formatTime(@BaseRef.createdate, '$day, $mon $year'))
~~~              </span>
~~~            </a>
~~~        </h3>
~~~     </noautolink>$n%STARTALIASAREA%$n
~~~     </div>
~~~     <div class=\"blogComment\">
~~~     %DBCALL{"%TOPIC%" section="format"}%
~~~     </div>"
~~~ }% 
%~~ DBCALL{"RenderDocNavigation" 
~~~   NAME="%NAME%" 
~~~   WHERE="BlogRef='%DBQUERY{topic="%NAME%" format="$formfield(BlogRef)"}%'"
~~~   ORDER="created"
~~~ }%
%STOPINCLUDE%

Format

%STARTSECTION{"format"}%
*~~ <h3 style=\"margin-bottom:0px;padding-bottom:0px\">
~~~   <a name=\"$topic\"></a><a name=\"$expand(Nr)\"></a>
~~~   <span class=\"blogCommentNr\">$expand(Nr)</span>
~~~   $percntIFDEFINEDTHEN{\"$expand(Url)\"}$percnt
~~~     [[$expand(Url)][$expand(Name)]] 
~~~     <a href=\"$percntSCRIPTURL{\"view\"}$percnt/$web/$topic\"
~~~        title=\"permalink to <nop>$topic\">
~~~   $percntELSEDEFINED$percnt
~~~      $percntCALC{
~~~        \"$dollarIF($dollarEXISTS(%MAINWEB%.$expand(Name)),
~~~          [[%MAINWEB%.$expand(Name)][$expand(Name)]] 
~~~          <a href=\\"$percntSCRIPTURL{\"view\"}$percnt/$web/$topic\\"
~~~             title=\\"permalink to <nop>$topic\">,
~~~          <a href=\\"$percntSCRIPTURL{\"view\"}$percnt/$web/$topic\\"
~~~             title=\\"permalink to <nop>$topic\\">$expand(Name))\"
~~~      }$percnt
~~~   $percntFIDEFINED%
~~~   <span class=\"blogDate\">
~~~     replied
~~~     $percntTIMESINCE{
~~~        from=\"$expand(@BaseRef.createdate)\"
~~~        to=\"$expand(createdate)\"
~~~        format=\"$time after the incident\"
~~~        null=\"immediately\"
~~~      }$percnt
~~~   </span></a>
*~~   $percntREDDOT{\"$web.$topic\" grant=\"MichaelDaum\"}$percnt 
~~~ </h3>$n
~~~ <noautolink>$n
~~~    $percntIFDEFINEDTHEN{\"$expand(Headline)\" glue=\"off\"}$percnt$n
~~~       <h4>$expand(Headline)</h4>$n
~~~    $percntFIDEFINED$percnt$n
~~~ %STARTALIASAREA%$n
~~~ <div class=\"blogCommentText\">$n
~~~    $expand(Text)
~~~    ...&nbsp;
*~~   <a href=\"$percntSCRIPTURL{\"view\"}$percnt/$web/$topic#bottomComment\"
~~~      title=\"comment on <nop>$topic\">reply</a>
~~~ </div>$n
~~~ %STOPALIASAREA%$n
~~~ </noautolink>
*~~ 
%ENDSECTION{"format"}%

Test

Calls to 'RenderBlogComment'

TopicForm
TopicType: TopicFunction
TopicDescription: Render a single BlogComment
r1 - 2005-11-17 - 10:20:22 - TWikiContributor
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
Atmel®, AVR® and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries.
All other trademarks are the property of their respective owners.