Documentation · ViewHelper reference

XSD schema file | vhs 2.1.3

Math / ModuloViewHelper

Math: Modulo Perform modulo on $input. Returns the same type as $input, i.e. if given an array, will transform each member and return the result. Supports array and Iterator (in the following descriptions "array" means both these types):

If $a and $b are both arrays of the same size then modulo is performed on $a using members of $b, by their index (so these must match in both arrays).

If $a is an array and $b is a number then modulo is performed on $a using $b for each calculation.

If $a and $b are both numbers simple modulo is performed.

  • Tag usage example

    <v:math.modulo a="[mixed]" fail="1" b="[mixed]">
    	<!-- tag content - may be ignored! -->
  • Inline usage example

    {v:math.modulo(a: [mixed], fail: 1, b: [mixed])}


Argument Description Type

First number for calculation


Second number or Iterator/Traversable/Array for calculation


If TRUE, throws an Exception if argument "a" is not specified and no child content or inline argument is found. Usually okay to use a NULL value (as integer zero).

Required attribute

Revision history

commit 839518dce4933fcd10b007d8b27814067040a9b7
Author: Claus Due <*****>
Date:   Fri Nov 2 22:01:46 2012 +0100

    [FEATURE] Basic Math ViewHelpers
    Ceil, Floor, Round, Division, Sum, Product, Subtract and Modulo
    ViewHelpers. Support multiple chained syntax, i.e. {value ->
    v:math.floor() -> v:math.sum()}.

commit 9698ff26456133f69e8de73aeb9435d93a83cf68
Author: Claus Due <*****>
Date:   Tue Nov 20 20:38:54 2012 +0100

    [TASK] Adapt all Math ViewHelpers to desired base
    This change brings to life the Single and Multiple Math ViewHelpers and adapts all current Math ViewHelpers to the new base classes.

commit 285ee9ab0ceb4a4eee28f07211d92b9f6958c65d
Author: Claus Due <*****>
Date:   Tue Nov 20 21:18:32 2012 +0100

    [DOC] Adjust class doc comment sub package annotation, Math ViewHelpers

commit da31bad1d9bb058c072ddb5591e8ed907a1ae8e1
Author: Claus Due <*****>
Date:   Tue Dec 31 23:08:37 2013 +0100

    [TASK] Happy new year!

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to file