A conditional block which outputs its content if the entry in context has any entry tags defined.
Optional Attributes:
tag - Allows a user to specify a particular tag to test.
Example code
The following iterates over MTEntries and, for any entries which have non-private tags assigned, prints out the entry title and all of the non-private tags that are assigned to the entry (glued together by a comma and a space)
<MTEntries>
<MTEntryIfTagged>
The entry "<$MTEntryTitle$>" is tagged:
<MTEntryTags glue=", "><$MTTagName$></MTEntryTags>
</MTEntryIfTagged>
</MTEntries>
The following prints out the entry title for each entry in the MTEntries loop as well as an "Important" icon when the entry is tagged "Important":
<MTEntries>
<MTEntryIfTagged tag="Important">
<img src="important.gif" alt="Important"/>
</MTEntryIfTagged>
<$MTEntryTitle>
</MTEntries>
Like with all conditional blocks, you can use MTElse to handle the inverse situation. In the example below case, something is printed for each entry returned by MTEntries. If there are tags assigned to the entry, the output is the same as in the first example. If not, the entry title is printed along with a message indicating there are no tags.
<MTEntries>
The entry "<$MTEntryTitle$>"
<MTEntryIfTagged>
is tagged: <MTEntryTags glue=", "><$MTTagName$></MTEntryTags>
<MTElse>
has no entry tags.
</MTElse>
</MTEntryIfTagged>
</MTEntries>
Naturally, you can also nest MTEntryIfTagged blocks to test for multiple individual tags or to test for a particular tag first and then for the presence of any tag.
Below is a complex example demonstrating multiple nested blocks and use of MTElse. It displays one of four images next to each entry title based on whether something is tagged "important" and then additionally tagged additionally "feature" or "bug":
<MTEntries>
<MTEntryIfTagged tag="Important">
<MTEntryIfTagged tag="Feature">
<img src="important_feature.gif" alt="Important feature"/>
<MTElse>
<MTEntryIfTagged tag="Bug">
<img src="important_bug.gif" alt="Important bug"/>
<MTElse>
<img src="important.gif" alt="Important"/>
</MTElse>
</MTEntryIfTagged>
</MTElse>
</MTEntryIfTagged>
<MTElse>
<img src="not_important.gif" alt="Not important"/>
</MTElse>
</MTEntryIfTagged>
<$MTEntryTitle>
</MTEntries>
See Chapter 8 in the Users and Administrators Guide entitled "Customizing Your Published Weblogs" for more examples related to entry tags, including the creation of "tag clouds".
You can download the Users and Administrators Guide here.