%META:TOPICINFO{author="TWikiContributor" date="1145545546" format="1.1" reprev="1.22" version="1.1"}%
%META:TOPICPARENT{name="TopicFunction"}%
---+ Function: %TOPIC%
%FORMFIELD{"TopicDescription"}%

---++ Parameters
   * NAME: BlogEntry topic name

---++ Urlparams
   * cat: SubjectCategory which this BlogEntry is part of; navigation between
     BlogEntries is restricted to this category (optional)

---++ Implementation
---+++ Main
<verbatim>
%STARTINCLUDE%
*~~
~~~ %STOPALIASAREA%
~~~ 
%~~ DBCALL{"RenderDocNavigation" 
~~~   NAME="%NAME%" 
~~~   WHERE="TopicType=~'\bBlogEntry\b' AND State='published'
~~~     AND SubjectCategory=~'\b%URLPARAM{"cat" default=".*"}%\b'"
~~~   REVERSE="on"
~~~   PARAMS="%IFDEFINED{"%URLPARAM{"cat"}%" then="cat=$test"}%"
~~~ }%
~~~ <a name="%WEB%_%NAME%"></a>
~~~
%~~ DBQUERY{%IFDEFINED{"%WIKINAME%" as="TWikiGuest" then="\"State='published'\""}%
~~~   topic="%NAME%" web="%WEB%"
~~~   format="%DBCALL{"%TOPIC%" section="format"
~~~     PARAMS="%IFDEFINED{"%URLPARAM{"cat"}%" then="cat=$test"}%"
~~~   }%"
~~~ }%
~~~
%~~ DBQUERY{"State='unpublished'" topic="%NAME%" 
~~~   format="$percntDBCALL{\"BlogHelpText\" 
~~~     section=\"Unpublished\"
~~~     NAME=\"posting\"}$percnt"
~~~ }%
~~~
%~~ DBCALL{"RenderDocNavigation" 
~~~   NAME="%NAME%" 
~~~   WHERE="TopicType=~'\bBlogEntry\b' AND State='published
~~~     AND SubjectCategory=~'\b%URLPARAM{"cat" default=".*"}%\b'"
~~~   REVERSE="on"
~~~   PARAMS="%IFDEFINED{"%URLPARAM{"cat"}%" then="cat=$test"}%"
~~~ }%
~~~ %STARTALIASAREA%
*~~
%STOPINCLUDE%
</verbatim>

---+++ Format
<verbatim>
%STARTSECTION{"format"}%
*~~ <div class=\"blogEntry\">
~~~   $n<noautolink>$n
~~~   <div class=\"blogHeadline\">
~~~   <h1>
~~~     <a href=\"$percntSCRIPTURLPATH{\"view\"}$percnt/$web/$topic
*~~        %IFDEFINED{"%PARAMS%" then="?%PARAMS%"}%\" 
~~~        title=\"permalink to <nop>$topic\">
~~~       $formfield(Headline)
*~~     </a>$percntREDDOT{\"$web.$topic\"}$percnt
~~~   </h1></div>
~~~   $n</noautolink>$n
~~~   <div class=\"blogInfo\">
~~~     <span class=\"blogDate\">
~~~       $formatTime(createdate, '$day $mon $year - $hour:$minute')
~~~     </span>
~~~     $percntFORMATLIST{\"$formfield(SubjectCategory)\" sort=\"on\"
~~~       header=\"in <span class=\\"blogCategory\\">\"
~~~       format=\"<a href=\\"%SCRIPTURLPATH{"view"}%/$web/$1\\" rel=\\"tag\\">$1</a>\"
~~~       footer=\"</span>\"
~~~     }$percnt
~~~     $percntTAGCLOUD{\"$formfield(BlogTag)\" sort=\"on\"
~~~       split=\"[\s,]+\"
~~~       sort=\"weight\" 
~~~       warn=\"off\"
~~~       header=\"tagged <span class=\\"blogTag\\">\"
~~~       separator=\", \"
~~~       format=\"<a href=\\"%SCRIPTURLPATH{"view"}%/$web/BlogArchive?mode=tag;search=$term\\" 
~~~                   rel=\\"tag\\">$term</a>\"
~~~       footer=\"</span>\"
~~~     }$percnt
~~~     <span class=\"blogAuthor\">by [[$web.$formfield(BlogAuthor)][$formfield(BlogAuthor)]] </span> 
~~~     $n
~~~   </div>
~~~   %STARTALIASAREA%
~~~   <div class=\"blogText\">
~~~      $n<noautolink>$n
~~~      <div class=\"blogTeaser\">
~~~        $formfield(Teaser)
~~~      </div>$n
~~~      $formfield(Text)
~~~      $n</noautolink>$n
~~~   </div>
~~~   %STOPALIASAREA%
~~~   <br clear=\"all\" />
~~~ </div>
*~~ 
%ENDSECTION{"format"}%
</verbatim>

---++ Test
<div class="alt">
%DBCALL{"%TOPIC%" NAME="BlogEntry0"}%
</div>

%DBCALL{"RenderFunctionCallers"}%

<!--
   * Set ALLOWTOPICCHANGE = %MAINWEB%.BlogAdminGroup
   * Set SIDEBAR = Admin
   * Set SIDEBARARG = TopicFunction
-->


%META:FORM{name="TopicForm"}%
%META:FIELD{name="TopicType" attributes="M" title="TopicType" value="TopicFunction"}%
%META:FIELD{name="TopicDescription" attributes="M" title="TopicDescription" value="Render a single BlogEntry"}%
