RenderBlogEntries
Render a set of postings to leaf through

%REVINFO{ " $date - $hour:$min " rev=" IF{ "%NATMAXREV%!=%CURREV%" then="%CURREV%" }: Syntax error in '%NATMAXREV%!=%CURREV%' at '%NATMAXREV%!=%CURREV%' " topic="Applications/BlogApp.RenderBlogEntries" }% | Version 1 |

Documentation

This TopicFunction displays a collection of BlogEntries within the given CATegory and/or TAG.

Parameters
  • SKIP: offset into the archive
  • LIMIT: number of postings to show at max
  • CAT: categories to extract (optional)
  • TAG: tagged entries to be extracted (optional)
  • STICKY: a pattern the Sticky field must match to list the posting see the "Sticky" definition in Blog Entry (optional)
  • NOSTICKY: same as STICKY but with inverse logic
  • FROM_TIME: lower boundary of timespan to display in epoch seconds
  • TO_TIME: uppwer boundary of timespan to display in epoch seconds
  • ONLYTEASER: switch "on" to just render the teaser section; defaults to rendering the full posting

Implementation

%STARTINCLUDE%<!-- -->
<noautolink>
%DBQUERY{
  "TopicType=~'\bBlogEntry\b'
   AND State != 'unpublished'
   AND topic != 'WebTopicEditTemplate'
   %IF{"'%FROM_TIME{default=""}%' != ''" then="AND publishdate >= '%FROM_TIME%'"}%
   %IF{"'%TO_TIME{default=""}%' != ''" then="AND publishdate < '%TO_TIME%'"}%
   %IF{"'%CAT{default=""}%' != ''" then="AND topic ISA '%CAT%'"}%
   %IF{"'%TAG{default=""}%' != ''" then="AND Tag=~'\b%TAG%\b'"}%
   %IF{"'%STICKY{default=""}%' != ''" then="AND Sticky=~'\b%STICKY%\b'"}%
   %IF{"'%NOSTICKY{default=""}%' != ''" then="AND !(Sticky=~'\b%NOSTICKY%\b')"}%
  "
  limit="%LIMIT{default="5"}%" 
  skip="%SKIP{default="0"}%" 
  sort="publishdate" 
  reverse="on" 
  hidenull="on"
  web="%BASEWEB%" 
  header="%IF{"'%STICKY{default=""}%' != ''" then="<div class='blogEntriesSticky'>"}%"
  format="<div class='blogEntry'>
    <div class='foswikiTopicInfo'>
      <h1>
        <div class='blogCommentCount foswikiRight'>
        $percntDBCALL{\"Applications.BlogApp.RenderNumberOfComments\"
          THETOPIC=\"$web.$topic\"
          COMMENTSYSTEM=\"$expand(preferences.COMMENTSYSTEM or '%COMMENTSYSTEM{default="metacomment"}%')\"
        }$percnt</div>
        [[$web.$topic]] 
        $percntIF{\"'$expand(State)' = 'unpublished'\"
          then=\"<span class='foswikiAlert foswikiSmall'>(%TRANSLATE{"unpublished"}%)</span>\"
        }$percnt<!-- -->
        $percntREDDOT{\"$web.$topic\"}$percnt<!-- -->
        <div class='foswikiTopicSummary'>$expand(Summary')</div>
      </h1>
      %IF{"'%STICKY{default=""}%' = ''"  
         then="$percntDBCALL{\"%WEB%.%TOPIC%\" section=\"revinfo\"}$percnt" 
      }%<!-- -->
    </div>
    <div class='blogText hyphenate clearfix'>
$percntDBCALL{\"$web.$topic\" 
   $percntIF{\"'%ONLYTEASER{default="off"}%'='on' AND '$expand(_sections)'!=''\" 
      then=\"section=\\"teaser\\"\"
   }$percnt
}$percnt 
       <div class='blogMore'>[[$web.$topic][%TRANSLATE{"Read more"}%]]</div>
    </div>
    </div>"
   footer="%IF{"'%STICKY{default=""}%' != ''" then="</div>"}%
     $percntDBCALL{\"%WEB%.%TOPIC%\" 
       section=\"pagination%IF{"'%STICKY{default=""}%'!=''" then="DISABLED"}%\" 
       warn=\"off\"
       LIMIT=\"%LIMIT{default="5"}%\"  
       SKIP=\"%SKIP{default="0"}%\"  
       COUNT=\"$count\" 
       CLASS=\"blogBottomPagination\"
       PARAMS=\"%IF{
           "'%STICKY{default=""}%'!=''" then="&sticky=%STICKY%"
         }%%IF{
           "'%CAT{default=""}%'!=''" then="&catname=%CAT%"
         }%\"
     }$percnt<!-- -->"
}%<!-- -->
</pre>
</noautolink>
<!-- -->%STOPINCLUDE%

Revinfo

%STARTSECTION{"revinfo"}%%JQICON{"fa-calendar"}% <nop>$formatTime(publishdate)
<span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-user"}% $percntFORMATLIST{ 
   \"$expand(Author or createauthor)\"  
   split=\"\s*,\s*\"  
   format=\"$dollarpercntIF{\\"istopic '%USERSWEB%.$1'\\" then=\\"[[%USERSWEB%.$1]]\\" else=\\"<nop>$1\\"}$dollarpercnt\"  
   separator=\", \" 
}$percnt
$percntIF{\"'$expand(total_likes)'>0\"
   then=\"<span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-thumbs-o-up" class="fa-flip-horizontal"}% $expand(total_likes)\"
}$percnt<!-- -->
$percntCATINFO{
   topic=\"$web.$topic\"
   exclude=\"TopCategory\"
   header=\"<span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-folder"}% \"
}$percnt<!-- -->
$percntTAGINFO{
   topic=\"$web.$topic\"
   header=\"<span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-tag"}% \"
}$percnt<!-- -->%ENDSECTION{"revinfo"}%

Pagination

%STARTSECTION{"pagination"}%<!-- -->
%CALCULATE{"$SET(theNextSkip,$EVAL($VALUE(%SKIP{default="0"}%)+$VALUE(%LIMIT{default="5"}%)))$SET(thePrevSkip,$EVAL($VALUE(%SKIP{default="0"}%)-$VALUE(%LIMIT{default="5}%)))$IF($GET(thePrevSkip) < 0,$SET(thePrevSkip,0))"}%<!-- -->
<div class='blogPagination foswikiSmallish foswikiHideOnPrint clearfix %CLASS{default=""}%'> 
<div class='blogPrev' %IF{"%SKIP{default="0"}% = 0" then="style='display:none'"}%> 
<a href='%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%?skip=%CALCULATE{"$GET(thePrevSkip)"}%&limit=%LIMIT{default="5"}%%PARAMS{default=""}%'>%TRANSLATE{"previous page"}%</a> 
</div> 
<div class='blogNext' %IF{"%CALCULATE{"$GET(theNextSkip)"}% >= %COUNT%" then="style='display:none'"}%>
<a href='%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%?skip=%CALCULATE{"$GET(theNextSkip)"}%&limit=%LIMIT{default="5"}%%PARAMS{default=""}%'>%TRANSLATE{"next page"}%</a> 
</div> 
</div><!-- -->%ENDSECTION{"pagination"}%

Test

no stickiness

5
Welcome to BlogPlugin 2.0 %REDDOT{"Applications.BlogApp.BlogEntry0"}%
test summary

02 May 2019 | Henry Miller, Stefan Zweig | News | , , , , ,
Pellentesque fringilla scelerisque blandit! Vivamus quis rhoncus turpis. Nunc vestibulum purus at ipsum aliquam porta. Nullam lobortis, lacus sed porttitor viverra, nulla tellus iaculis ligula, eu vestibulum nunc lacus ac magna. Nulla feugiat cursus mattis. Mauris aliquam diam at sem mattis iaculis. Praesent ultricies, ipsum quis adipiscing fermentum, dui leo congue orci, a viverra nisi sem lobortis orci? Praesent ultrices magna ac ante auctor sit amet lobortis enim vehicula. Morbi tincidunt accumsan augue nec convallis! Sed blandit orci quis orci iaculis suscipit! Nam vulputate adipiscing sollicitudin. Morbi erat lectus, fermentum sit amet tristique in, euismod eu libero. Donec placerat ornare auctor. Donec non nisl ac ante adipiscing bibendum. Donec quam lectus, porta eu porta et, eleifend porta dui?

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse vulputate malesuada eros, sed ullamcorper odio ullamcorper at. Mauris tincidunt luctus nibh in blandit. Vestibulum nec vulputate mauris. Vestibulum cursus ligula a lacus molestie nec posuere mauris interdum. Nullam ut sollicitudin justo. Morbi egestas consequat quam, a molestie diam pharetra a. Vestibulum congue neque ut metus sollicitudin vitae pharetra ante tempus. Sed egestas accumsan felis vel feugiat. Duis non mi sed metus imperdiet luctus. Praesent vel ipsum id tellus sollicitudin volutpat sit amet interdum turpis. Maecenas a bibendum sem.

4
This is a test %REDDOT{"Applications.BlogApp.ThisIsATest"}%
Etiam sitx amet nisl odio. Mauris pretium consectetur feugiat. Nam volutpat.

30 April 2015 | ProjectContributor | , ,
Maecenas nec enim at mauris varius porta. Praesent elementum ullamcorper diam in pellentesque. Donec in mauris gravida est sollicitudin feugiat ullamcorper non ipsum. Pellentesque rhoncus imperdiet dui, a interdum enim blandit ac. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In eleifend vulputate pretium? Donec id purus ante; vel pharetra erat. In ante dui, dapibus quis semper ac, pretium vel nisi. Etiam nec arcu nisl, eu interdum enim. Duis justo ante, accumsan eget rutrum a, dictum at orci. Maecenas leo orci; vehicula facilisis convallis in, lobortis lobortis nibh. Cras dignissim pharetra rhoncus!

Etiam malesuada elit non sem eleifend ornare? Sed porttitor suscipit lobortis. Cras in eros et lorem tempor aliquet sed et diam. Ut ipsum diam, consequat nec egestas pulvinar, dignissim quis nibh. Phasellus non velit sapien, non posuere nunc. Phasellus lorem diam, auctor dapibus euismod eget, egestas sit amet ipsum. Morbi facilisis, enim id hendrerit porta, odio nisi ultrices tortor, eget rhoncus nunc justo et ante. Nam sit amet arcu augue. Nulla risus mauris, rhoncus a interdum at, blandit vel magna. Mauris in lorem nisl. Nullam tortor neque; vestibulum ut condimentum eget, tristique in metus. Donec pretium elit ut nisl vestibulum malesuada.

Sed fermentum orci quis ante commodo bibendum. Maecenas rutrum ultrices nunc; ut volutpat mi vehicula in. Duis porttitor diam sed metus dignissim fermentum. Maecenas pretium diam eget urna consectetur mattis sit amet ac neque massa nunc.

stickiness

4
This is a test %REDDOT{"Applications.BlogApp.ThisIsATest"}%
Etiam sitx amet nisl odio. Mauris pretium consectetur feugiat. Nam volutpat.

Maecenas nec enim at mauris varius porta. Praesent elementum ullamcorper diam in pellentesque. Donec in mauris gravida est sollicitudin feugiat ullamcorper non ipsum. Pellentesque rhoncus imperdiet dui, a interdum enim blandit ac. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In eleifend vulputate pretium? Donec id purus ante; vel pharetra erat. In ante dui, dapibus quis semper ac, pretium vel nisi. Etiam nec arcu nisl, eu interdum enim. Duis justo ante, accumsan eget rutrum a, dictum at orci. Maecenas leo orci; vehicula facilisis convallis in, lobortis lobortis nibh. Cras dignissim pharetra rhoncus!

Etiam malesuada elit non sem eleifend ornare? Sed porttitor suscipit lobortis. Cras in eros et lorem tempor aliquet sed et diam. Ut ipsum diam, consequat nec egestas pulvinar, dignissim quis nibh. Phasellus non velit sapien, non posuere nunc. Phasellus lorem diam, auctor dapibus euismod eget, egestas sit amet ipsum. Morbi facilisis, enim id hendrerit porta, odio nisi ultrices tortor, eget rhoncus nunc justo et ante. Nam sit amet arcu augue. Nulla risus mauris, rhoncus a interdum at, blandit vel magna. Mauris in lorem nisl. Nullam tortor neque; vestibulum ut condimentum eget, tristique in metus. Donec pretium elit ut nisl vestibulum malesuada.

Sed fermentum orci quis ante commodo bibendum. Maecenas rutrum ultrices nunc; ut volutpat mi vehicula in. Duis porttitor diam sed metus dignissim fermentum. Maecenas pretium diam eget urna consectetur mattis sit amet ac neque massa nunc.

Calls to 'RenderBlogEntries'

Copyright

© 2005-2019 http://michaeldaumconsulting.com

This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For more details read the LICENSE.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Warning: Can't find topic Applications/BlogApp.WebLeftBarExample

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback