This is an old revision of the document!


<tpl:CategoryIf>

Different tests on the characteristics of a category. The returned value will be 0 if false and 1 if true.

Attributes

url

Tests if the category has a given URL (the "URL" field in the category detail). To test if the category does not have a given URL, simply prefix the category URL with a "!".

has_entries

Tests if the category contains any entries.

Example

<tpl:CategoryIf has_entries="1">
 <p><a type="application/atom+xml" href="{{tpl:CategoryFeedURL type="atom"}}"
   title="{{tpl:lang This category's entries Atom feed}}" class="feed">{{tpl:lang Entries feed}}</a>
 </p>
</tpl:CategoryIf>

Display a text only if the category does not have the URL "my-category"

<tpl:CategoryIf url="!my-category">
  <p>A sample text</p>
</tpl:CategoryIf>

Note:

The ! in front of the URL inverts the meaning of the test

Wiki powered by Dokuwiki.