RenderRecentNews

02 May 2019 - 20:32 | Version 1 |

Documentation

This function renders a list of recent BlogEntries in the given web. Only published postings will be rendered as well as those not tagged "blogonly". Each posting's teaser will be extracted.

See also:

Parameters
  • SKIP: number of items to skip, default 0
  • LIMIT: number of items to show, default 4
  • THEWEB: web holding blog entries, default Blog
  • CAT: categories to extract (optional)
  • TAG: tagged entries to be extracted (optional)
  • SHOWREVINFO: on/off, default on

Implementation

%STARTINCLUDE%<noautolink>
%DBQUERY{
  "TopicType=~'\bBlogEntry\b' AND State!='unpublished' AND Tag!~'\bblogonly\b'
   %IF{"'%CAT{default=""}%' != ''" then="AND topic ISA '%CAT%'"}% 
   %IF{"'%TAG{default=""}%' != ''" then="AND Tag=~'\b%TAG%\b'"}%  
  "
  exclude="WebTopicEditTemplate"
  web="%THEWEB{default="Blog"}%" 
  sort="publishdate"
  format="<div class='blogEntry clearfix'>
   <h2>[[$web.$topic]]</h2>
   %IF{"'%SHOWREVINFO{default="on"}%'='on'"
      then="$dollarpercntDBCALL{\\"$percntWEB$percnt.$percntTOPIC$percnt\\" section=\\"revinfo\\" object=\\"$dollarweb.$dollartopic\\"}$dollarpercnt"
   }%<!-- -->
   $percntDBCALL{\"$web.$topic\" section=\"teaser\" warn=\"off\"}$percnt<!-- -->
   $percntCLEAR$percnt
   <p class='blogMore'>[[$web.$topic][%TRANSLATE{"Read more"}%]]</p>
  </div>"
  separator="$n"
  limit="%LIMIT{default="4"}%"
  skip="%SKIP{default="0"}%"
  reverse="on"
}%%ADDTOZONE{"head"
  id="BLOGPLUGIN::CSS"
  text="<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/BlogPlugin/blogplugin.css'  media='all' />"
}%
</noautolink>%STOPINCLUDE%

Revision Info

%STARTSECTION{"revinfo"}%<div class="foswikiGrayText"> 
  %DBQUERY{ 
    topic="%object%"  
    format="%JQICON{"fa-calendar"}% <span itemprop='datePublished' content='$formatTime(publishdate, '$year-$mo-$day')'>$formatTime(publishdate)</span> 
      <span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-user"}% $percntFORMATLIST{ 
      \"$expand(Author or createauthor)\"  
      split=\"\s*,\s*\"  
      format=\"$dollarpercntIF{\\"istopic '%USERSWEB%.$1'\\" then=\\"<a href='%SCRIPTURLPATH{view}%/%USERSWEB%/$1' rel='author' itemprop='author'>$dollarpercntGETTOPICTITLE{%USERSWEB%.$1}$dollarpercnt</a>\\" 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<!-- -->" 
  }% 
  %CATINFO{ 
    "%object%"  
    exclude="TopCategory"
    header="<span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-folder"}% " 
    format="<a href='$url' rel='tag' itemprop='keywords' class='$name'>$title</a>" 
  }% <!-- --> 
  %TAGINFO{ 
    "%object%" 
    header="<span class='foswikiRevisionSep'>&#124;</span> %JQICON{"fa-tag"}% " 
    format="<a href='$url' rel='tag' itemprop='keywords' class='$class'>$name</a>" 
  }% <!-- --> 
</div>%ENDSECTION{"revinfo"}%

Test

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.