%META:TOPICINFO{author="TWikiContributor" date="1139169536" format="1.1" version="1.1"}%
%META:TOPICPARENT{}%
---+ Function: %TOPIC%
%FORMFIELD{"TopicDescription"}%

---++ Parameters
   * NAME: topic name of a BlogComment, BlogEntry or BlogLink 
           to which the prev-next doc navigation is displayed
   * WHERE: search parameter to restrict the linked documents
   * ORDER: criterion how to sort set of documents (created, name, ...)
   * REVERSE: invert the sorting order (on, off)
   * PARAMS: additional url parameters (optional)


---++ Implementation
<verbatim>
%STARTINCLUDE%
*~~ 
<div class="blogNavigation">
<noautolink>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
  <td valign="top">
*~~
%~~ PREVDOC{"%NAME%" web="%WEB%" 
~~~   where="%WHERE%" 
~~~   order="%IFDEFINED{"%ORDER%" then="%ORDER%"}%"
~~~   reverse="%IFDEFINED{"%REVERSE%" then="%REVERSE%"}%"
~~~   format="&#171;"
~~~ }%
*~~
  </td>
  <td valign="top" class="blogPrev">
~~~
%~~ PREVDOC{"%NAME%" web="%WEB%"
~~~   where="%WHERE%" 
~~~   order="%IFDEFINED{"%ORDER%" then="%ORDER%"}%"
~~~   reverse="%IFDEFINED{"%REVERSE%" then="%REVERSE%"}%"
~~~   format="<a href=\"%SCRIPTURLPATH{"view"}%/$web/$topic
*~~     %IFDEFINED{"%PARAMS%" then="?%PARAMS%"}%\"
~~~     accesskey=\"b\"
~~~     $percntDBQUERY{topic=\"$topic\" web=\"%WEB%\" 
~~~       format=\"title=\\"$expand(Headline)\\">$expand(Name or Headline)\"
~~~     }$percnt</a>"
~~~ }% 
~~~
  </td>
  <td valign="top" class="blogNext"> 
~~~
%~~ NEXTDOC{"%NAME%" web="%WEB%"
~~~   where="%WHERE%" 
~~~   order="%IFDEFINED{"%ORDER%" then="%ORDER%"}%"
~~~   reverse="%IFDEFINED{"%REVERSE%" then="%REVERSE%"}%"
~~~   format="<a href=\"%SCRIPTURLPATH{"view"}%/$web/$topic
*~~     %IFDEFINED{"%PARAMS%" then="?%PARAMS%"}%\"
~~~     accesskey=\"n\"
~~~     $percntDBQUERY{topic=\"$topic\" web=\"%WEB%\" 
~~~       format=\"title=\\"$expand(Headline)\\">$expand(Name or Headline)\"
~~~     }$percnt</a>"
~~~ }% 
~~~
  </td>
  <td valign="top">
*~~
%~~ NEXTDOC{"%NAME%" web="%WEB%" 
~~~   where="%WHERE%" 
~~~   order="%IFDEFINED{"%ORDER%" then="%ORDER%"}%"
~~~   reverse="%IFDEFINED{"%REVERSE%" then="%REVERSE%"}%"
~~~   format="&#187;"
~~~ }%
*~~
  </td>
</tr>
</table>
</div>
*~~
%STOPINCLUDE%
</verbatim>

<!-- interrut glue -->

---++ Test
---+++ BlogEntries
<div class="alt">
%~~ DBCALL{"%TOPIC%" 
~~~   NAME="BlogEntry0" 
~~~   WHERE="TopicType=~'\bBlogEntry\b' AND State='published'"
~~~ }%
</div>

---+++ BlogLinks
<div class="alt">
%~~ DBCALL{"%TOPIC%" 
~~~   NAME="BlogLink0"
~~~   WHERE="TopicType=~'\bBlogLink\b'"
~~~   ORDER="Name"
~~~ }%
</div>

---+++ BlogLinks (reverse)
<div class="alt">
%~~ DBCALL{"%TOPIC%" 
~~~   NAME="BlogLink0"
~~~   WHERE="TopicType=~'\bBlogLink\b'"
~~~   ORDER="Name"
~~~   REVERSE="on"
~~~ }%
</div>

---+++ BlogComments
<div class="alt">
%~~ DBCALL{"%TOPIC%" 
~~~   NAME="BlogComment1"
~~~   WHERE="BlogRef='%DBQUERY{topic="BlogComment1" format="$formfield(BlogRef)"}%'"
~~~   ORDER="created"
~~~ }%
<noautolink>
</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 double linked list to previous and next documents"}%
