Textpattern logo

Help?

if thumbnail

From Textbook

<txp:if_thumbnail />

The if_thumbnail tag is a conditional tag and always used as an opening and closing pair, like this...

<txp:if_thumbnail>
...conditional statement...
</txp:if_thumbnail>

The tag will execute the contained statements if the current image (from an image_list) has a thumbnail assigned to it. Must always be used in an image context.

Contents

Attributes

This tag has no attributes.

Examples

Example 1: Only show a thumbnail if one exists

<txp:image_list author="neo" wraptag="div" class="author_gallery">
   <txp:if_thumbnail>
      <div><txp:thumbnail /></div>
   <txp:else />
      <div>No thumbnail</div>
   </txp:if_thumbnail>
   <txp:image_info />
</txp:image_list>
What this does...
For each image uploaded by neo, display its thumbnail if it has one, or the text "No thumbnail" if it doesn't. Add the caption beneath that using image_info.

Other tags used: image_list, else, image_info, thumbnail

Genealogy

Version 4.3.0

  • tag introduced

Translations [?]...

About Textbook