Attributes common to every template tag

Modifying attributes

Almost every content displaying template tag {{tpl:EntryTitle}}, {{tpl:CategoryTitle}}, etc.) has attributes to modify the content before displaying it.

remove_html

When assigned a value of 1, removes every HTML tag from the content substitute normal text to HTML entities.

Note: one has to use encode_html="1" beforehand to ensure that the html inserts in posts which are using the wiki syntax are also processed by the remove_html.

Example

{{tpl:EntryContent encode_html="1" remove_html="1" cut_string="200"}}

encode_xml

When assigned a value of 1, returns a string where XML entities are substituted to every special character.

encode_html

When assigned a value of 1, returns a string where HTML entities are substituted to every special character.

cut_string

Cuts the content to the given number of characters, while preserving words. It is always a good idea to use that attribute conjointly with remove_html="1".

lower_case

When assigned a value of 1, lowercases the string.

upper_case

When assigned a value of 1, uppercases the string.

Conditional attributes

Conditional attributes are to be used on some of the block tags (such as <tpl:EntryIf>.) to fine tune the modalities of conditions requirements.

operator

Specifies if the conditions used in the tag's attributes are to be all met (logical operator AND) or if only one of them has to be met (logical operator OR) to verify the whole test.

  • The logical operator AND is noted as "or" or "||"
  • The logical operator OR is noted as "and" or "&&"

Examples

A comment's first 20 characters, all uppercase

{{tpl:CommentContent cut_string="20" remove_html="1" upper_case="1"}}

Display in a bold typeface every entry where comments or pings are allowed

<tpl:Entries>
  <tpl:EntriesHeader><ul></tpl:EntriesHeader>
  <li<tpl:EntryIf comments_active="1" pings_active="1" operator="or"> style="font-weight:bold;"</tpl:EntryIf>>
    {{tpl:EntryTitle encode_html="1"}}
  </li>
  <tpl:EntriesFooter></ul></tpl:EntriesFooter>
</tpl:Entries>

Wiki powered by Dokuwiki.