[pmwiki-users] Pagelist template - repeat each N entries

Petko Yotov 5ko at 5ko.fr
Mon Feb 4 02:03:58 CST 2013

Oliver Betz writes:
> repeating certain elements every N entries of a page list would be
> nice e.g. for table headers.
> Ist there a simple way to get this?

Yes, enable the "modulo" MarkupExpression, in config.php:

   # from Cookbook:MarkupExprPlus by DFaure
   $MarkupExpr['mod'] = 'mod' => '0 + ($args[0] % $args[1])';

Then, in the pagelist template (:template each:) section, for example for  
every 12 pages, use this:

(:if equal "{(mod {$$PageCount} 12)}" "0":)
Repeat header here after 12 lines

Note, if you repeat the same header, it may be better to use

(:if equal "{(mod {$$PageCount} 12)}" "1":)

which will also write the first header.


More information about the pmwiki-users mailing list