<tpl:EntryIf>

Allows to set tags for showing tag features for your entry inside the template tag <tpl:Entries> or in the file post.html. The content of this tag is displayed only, if the test is successful.

Attribute

type

Verify type in the entry. Value by default : post (ordinary entry).

category

Verify if the post belongs to a given category. A category is identified by its URL.

In addition, in order to verify if the entry does not belongs to a category, all you have to do is to put an attention mark to the URL, "!".

This example shows « Attention : There is no Mammal » if the entry doesn't have a sub category Mammal in the category Animals.

<tpl:EntryIf category="!Animals/Mammal">
<p><strong>Attention :</strong> There is no Mammal.</p>
</tpl:EntryIf>

categories

Vérify that a post belongs to one of several given categories. Categories are identified by their URL. Additionnally, to check that a post does not belong to any of a given list of categories, you must prefix their URLs with a "!".

The following example will display « This is a mammal or a bird. » if the post belongs to the category Mammals or Birds.

<tpl:EntryIf categories="Mammals,Birds" operator="or">
<p>This is a mammal or a bird.</p>
</tpl:EntryIf>

The following example will display « Careful : it is not a mammal nor a bird. » if the post does not belongs to the category Mammals or Birds.

<tpl:EntryIf category="!Mammals,!Birds">
<p><strong>Careful :</strong> it is not a mammal nor a bird.</p>
</tpl:EntryIf>

first

Verifies, if the entry is the first in the list or not. The attribute first="0" verifies all entries except the first one and the attribute first="1" verifies only the first entry.

For example, if you want to show the titles of your entries except the first one, you can use the following code :

<tpl:Entries>
<tpl:EntryIf first="0">
<h2>{{tpl:EntryTitle encode_html="1"}}</h2>
</tpl:EntryIf>
</tpl:Entries>

odd

Verifies, if an entry is odd-numbered with odd="1" or verifies, if the entry is numbered with odd="0".

extended

Verifies, if an entry includes an introduction (extended="1") or doesn't include one (extended="0").

selected

Verifies, if an entry is an entry is selected (selected="1") or it is no entry (selected="0").

has_category

Verifies, if an entry appears with a category (has_category="1") or if there is a category missing (has_category="0").

has_attachment

Verifies, if an entry has got attachments (has_attachment="1") or if there is no attachment (has_attachment="0").

comments_active

Verifies, if comments are allowed for an entry (comments_active="1") or this function is disabled (comments_active="0").

pings_active

Verifies, if pings are allowed for an entry (pings_active="1") or this function is disabled (pings_active="0").

has_comment

Verifies, if an entry has got a comment at least (has_comment="1") or no comment has been given (has_comment="0").

has_ping

Verifies, if an entry has got a ping (has_ping="1") or no ping has been requested (has_ping="0").

show_comments

Verifies, if an entry has comments and if they have the status "published". With show_comments="0", it verifies if the entry has no comment and if yes that they are "closed".

show_pings

Verifies, if an entry has pings and if they have the status "published". With show_pings="0", it verifies if the entry has no comment and if yes that they are "closed".

URL

Tests, if there is an URL for an entry (zone "URL" of the entry detail). In order to test if there is no URL for the entry given, the URL of an entry appears with an "!"

Examples

Extracts

Displays the introduction "Excerpt" of an entry or the first 200 characters if there is no "Excerpt".

<tpl:Entries>
  <h2>{{tpl:EntryTitle}}</h2>
  <tpl:EntryIf extended="1">
    <p>{{tpl:EntryExcerpt remove_html="1" encode_html="1"}}</p>
  </tpl:EntryIf>
  <tpl:EntryIf extended="0">
    <p>{{tpl:EntryContent remove_html="1" encode_html="1" cut_string="200"}}</p>
  </tpl:EntryIf>
</tpl:Entries>

Wiki powered by Dokuwiki.