Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.1
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 1 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

ckr_image_count

This plugin provides two new tags:

  • <txp:ckr_image_count /> – output the count of all images
  • <txp:ckr_if_image_count></txp:ckr_if_image_count> – a conditional tag

 

Counting images with ckr_image_count

Place the <txp:ckr_image_count /> tag wherever you want the count to appear. The tag supports one attribute called category. If set to a category’s name, only images within will be counted.

Examples:

<txp:ckr_image_count /> – displays the count of all images
<txp:ckr_image_count category="mycategory" /> – displays the count of images within given category

 

Using the conditional tag ckr_if_image_count

Place the <txp:ckr_if_image_count></txp:ckr_if_image_count> tags wherever you want to check for the given condition. The tag supports the category attribute as well and in addition to it the following four: min, max, equal, not. At least one of them must be given, only min and max can be combined. Furthermore it offers support for Textpattern’s internal <txp:else /> tag.

Simple examples:

<txp:ckr_if_image_count min="3">
    At least 3 images available.
</txp:ckr_if_image_count>
<txp:ckr_if_image_count max="5">
    There are not more than 5 images available.
</txp:ckr_if_image_count>

Examples for combining category and any condition:

<txp:ckr_if_image_count category="mycategory" equal="5">
    Category "mycategory" contains 5 images.
</txp:ckr_if_image_count>
<txp:ckr_if_image_count category="mycategory" not="5">
    Category "mycategory" contains anything but 5 images.
</txp:ckr_if_image_count>

Examples for combining min and max attribute:

<txp:ckr_if_image_count min="1" max="5">
    There's at least more than 1 image, but less (or equal) than 5 images.
</txp:ckr_if_image_count>
<txp:ckr_if_image_count category="mycategory" min="1" max="5">
    Category "mycategory" contains more than 1 image, but less (or equal) than 5 images.
</txp:ckr_if_image_count>

Example for using the txp:else block:

<txp:ckr_if_image_count equal="7">
    There are exactly 7 images available.
<txp:else />
    There are anything but 7 images available.
</txp:ckr_if_image_count>

 

Combining ckr_if_image_count with ckr_if_image_count

Of course you can combine both tags in case you need to master a complex situation. Take a look at the following example to get a brief overview of what can be accomplished.

Example:

<txp:ckr_if_image_count category="mycategory" min="3">
    Category "mycategory" contains at least 
    <txp:ckr_image_count category="mycategory" /> images.
<txp:else />
    Category "mycategory" doesn't contain enough images.
    At least 3 are needed.
</txp:ckr_if_image_count>
Article Request Count:
Keywords/tags:
Initially released:
23 Jul 2009
Posted here:
23 Jul 2009
Article modified:
23 Jul 2009

You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern