The filter |print produces a human-readable display of the tag to which it applies.

-  When the tag is a string, for example:

"Once upon a time in London town..."

then the result displayed is this string passed through the filter |typo (unbreakable spaces, conversion of quotes...)

-  When the tag is an array which is itself a simple list, for example:

array('john', 'peter', 'lucie', 'zoe')

or an array where all the keys are numeric, for example:

array(0 => 'john', 1 => 'peter', 2 => 'lucie', 3 => 'zoe')

then the result displayed is a simple enumeration whose elements are separated by a comma.

In this example, the display will therefore be: "john, peter, lucie, zoe"

-  When the tag is an array which contains non-numeric keys or elements which are themselves arrays, the filter displays one line per entry, with the name of the key of the sub-array followed by the value (itself displayed according to the same rules: string or enumeration or array in lines).

For example [1] :

array('tree' => array('beech', 'pine', 'poplar'), 'flower' => array('red' => 'poppy', 'blue' => 'lavender', 'yellow' => 'marigold'))

will display the html source:

tree: beech, pine, poplar
&nbsp;red: poppy
&nbsp; blue: lavender
&nbsp; yellow: marigold

which will appear thus:

tree: beech, pine, poplar
 red: poppy
 blue: lavender
 yellow: marigold


[1this array can be a #ARRAY written in spip syntax:

#SET{table, #ARRAY{tree, #ARRAY{0, beech, 1, pine, 2, poplar}, flower, #ARRAY{red, poppy, blue, lavender, yellow, marigold}}}

Author jack Published : Updated : 23/07/23

Translations : English, français, Nederlands