zem_nth documentation

Display content every n-th step (0.1)

<txp:zem_nth> conditionally displays content every "n-th" step. Example uses:

  • Alternate or cycle colours and styles
  • Include a break only at specific positions in a list
  • Provide "glue" between articles in a list, without an extraneous element at the beginning or end
Attributes:
step
Step(s) on which to display. May be a single integer, a comma-separated list, a range ("1-5"), or a combination ("1-3, 5, 8, 11-16").
of
Cycle period, as an integer. Optional. "step=1 of=3" will trigger on every third item (step 1, 4, 7, 10, etc).
Examples for use in an article form:
<txp:zem_nth step=2 of=2><hr /></txp:zem_nth>
Show a HR every second article.
<txp:zem_nth step=1 of=2><div class="red" /></txp:zem_nth>
<txp:zem_nth step=2 of=2><div class="blue" /></txp:zem_nth>
Alternate colours.
<txp:zem_nth step=1 ><hr /></txp:zem_nth>
Show a HR after the first article only.
<txp:zem_nth step="1-9" ><hr /></txp:zem_nth>
Show a HR after the first nine articles, and nothing after subsequent articles.
<txp:zem_nth step=6 ></tr><tr></txp:zem_nth>
Break a table into two columns at the 6th item.


I <heart> you!

SteveC    Dec 24, 10:04 pm    #

zem, this is just awesome! Thank you!

andreas    Jan 15, 10:17 pm    #

Zem: word up. This thing is way more powerful than it seems at first. You should include in the docs that this thing can include an article tag inside an article form, for instance to include a floated excerpt of another article or random entry from a category every few articles.

Example (sans spaces):

< txp:zem_nth step=1 >< txp:article_custom category="some_category" sortby="rand()" limit="1" />< /txp:zem_nth>

This really moves TXP beyond what can be done with the competition. Thanks for everything.

Nick

Nick Valvo    Mar 23, 10:30 am    #

Work this plugin with article too? I want every second article settings float:left.

Help me, please

Ivorius    May 15, 08:06 pm    #

Commenting is closed for this article.