[pmwiki-devel] handling of input arrays

Hans design5 at softflow.co.uk
Fri Nov 23 16:45:37 CST 2007


I am trying to work out a sensible general way to treat arrays of
input values. Input controls can have names denoting the field as an
element in an array, like: name[]
If several of these are passed on as $_POST input for example, they
will be indexed name[0], name[1], name[2] etc.

Fox so far has treated these kind of arrays special in its value
substitutions by repeatedly applying all input to the array elements,
thereby generating multiple lines or sets of output. This immediately
runs into problems of there are two or more arrays.

Now I come to appreciate that an input array can be applied to several
target pages, by mapping the array index to the target page index.
But there may be occasions that an input array (or several) shall be
applied to a single target page, i.e. multiple output on one page.
But I cannot see any examples, so I am inclined to dismiss it.

The exception for this is when the input array fields have their keys
defined: name[1], name[2], name[3], or name[a], name[b] etc. instead
of name[]. Then it may be fair to map these to discrete substitution
variables {$$name[1]} {$$name[2]} etc. i.e. treat such names as normal
names. At least that's what I think so far.

Please share your thoughts on this!


  ~Hans




More information about the pmwiki-devel mailing list