Render Blogs By Author
Display of Blog entries with filter by author

29 June 2020 - 17:42 | Version 1 |

Documentation

This TopicFunction is based on Applications/BlogApp/RenderBlogEntries (and calls that topic) but adds filtering by Author. It also filters by CATegory and/or TAG.

Parameters
  • AUTHOR: Blog Author to display.
  • 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' %IF{"defined Author" then=" AND Author = '%URLPARAM{"Author"}%'"}%
   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{\"Applications.BlogApp.RenderBlogEntries\" 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{\"Applications.BlogApp.RenderBlogEntries\" 
       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%

Test

Calls to 'RenderBlogsByAuthor'

Copyright

© 2015 Your Name

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.
This site is powered by FoswikiCopyright © 2002-2024 by contributors to Wasserstoff-Fahrer Forum ImpressumDatenschutz  Feedback
This website is using cookies. More info. That's Fine