How do I search for all child topics, including their descendants?
%TREE{web="System" topic="AdminDocumentationCategory"}%
- There are several options for formatting, however, it doesn't seem to support delayed macros which is a necessary formatting feature required for some advanced usage.
- Only
TOPICPARENT.name
relationship is traversed.
- A cache of the topic heirarchy is maintained in
working
, so performance is reasonable.
%DBRECURSE{"System.AdminDocumentationCategory"}%
- Advanced formatting options, including all those supported by
DBQUERY
.
- Advanced querying options using the
filter
param, allowing you to traverse relationships other than TOPICPARENT.name
. See DBCacheContrib to read about the DBCache meta-map.
- A cache of all topic data is maintained as a normal part of DBCacheContrib feature, so performance is reasonable
You must consider using FastCGIEngineContrib or ModPerlEngineContrib in order to maintain site performance using DBCachePlugin & DBCacheContrib - although a site can be faster using these plugins, a Foswiki running "plain old CGI" will be slower unless mod_perl
or mod_fcgid
is used
3 Using nested includes
Coming soon.
<verbatim class="tml">%STARTSECTION{"recurse"}%%INCLUDE{
"%TOPIC%"
section="recursestep"
web="%IF{"NOT (defined web AND $'web')" then="%INCLUDINGWEB%" else="%web%"}%"
topic="%topic%"
query="%IF{"NOT (defined query AND $'query')" then="parent.name='$percnttopic$percnt' AND parent.name!=name" else="%query%"}%"
indent="%IF{"NOT (defined indent AND $'indent')" then="" else="%indent%"}%"
recurse="%IF{"NOT (defined recurse AND $'recurse')" then="off" else="%recurse%"}%"
header="%IF{"NOT (defined header AND $'header')" then="" else="%header%"}%"
format="%IF{"NOT (defined format AND $'format')" then="$percntindent$percnt * [[$web.$topic][$topic]]" else="%format%"}%"
separator="%IF{"NOT (defined separator AND $'separator')" then="$dollarn" else="%separator%"}%"
footer="%IF{"NOT (defined footer AND $'footer')" then="*Total:* $dollarntopics" else="%footer%"}%"
pager="%IF{"NOT (defined pager AND $'pager')" then="on" else="%pager%"}%"
pagesize="%IF{"NOT (defined pagesize AND $'pagesize')" then="10" else="%pagesize%"}%"
pagerformat="%IF{"NOT (defined pagerformat AND $'pagerformat')" then="Page $currentpage of $numberofpages [[$nexturl][next page]]" else="%pagerformat%"}%"
}%%ENDSECTION{"recurse"}%%STARTSECTION{"recursestep"}%%SEARCH{
"%query%"
nonoise="on"
type="query"
web="%web%"
recurse="%recurse%"
header="%header%"
limit="10"
format="%format%%separator%$percntINCLUDE{
limit=\"5\"
\"%WEB%.%TOPIC%\"
section=\"recursestep\"
web=\"$web\"
topic=\"$topic\"
indent=\"%indent% \"
}$percnt"
separator=""
nofinalnewline="on"
footer="%footer%"
pager="%pager%"
pagesize="%pagesize%"
pagerformat="%pagerformat%"
}%%ENDSECTION{"recursestep"}%</verbatim>
*Example:*
<verbatim class="tml">%INCLUDE{"%TOPIC%" section="recurse" web="System" topic="AdminDocumentationCategory"}%</verbatim>
*Result:*
<pre class="tml">%INCLUDE{"%TOPIC%" section="recurse" web="%SYSTEMWEB%" topic="AdminDocumentationCategory"}%</pre>
Notes:
<blockquote>%X% This is a *very* slow alternative to Extensions.TreePlugin & Extensions.DBCachePlugin (unless you're using Extensions.DBIStoreContrib or Extensions.MongoDBPlugin)</blockquote>
* TODO: Show a parameterised set statement (trunk/Foswiki 2.0 only)
* TODO: =separator= param not quite doing what it should
* Allows equivalent queries & formatting as Extensions.DBCachePlugin