[pmwiki-users] Page Text Variables Array . . .

Patrick R. Michaud pmichaud at pobox.com
Wed May 9 13:52:05 CDT 2007


On Wed, May 09, 2007 at 12:36:50PM -0400, Ben Wilson wrote:
> The following is my way of converting the Page Text Variable string
> and converting to a trimmed value array in my recipes. Pm, if this
> meets your approval, is it possible to add this function to the core
> so that other recipe developers could avail themselves of the
> function?
> 
> function PageVarA($pagename,$var,$delm=',') {
>     return array_map(trim, explode($delm, PageVar($pagename, $var)));
> }

I'm going to wait on this particular functionality (page variables
as arrays) simply because I want to think about the longer-term
ramifications a bit.  It may also be necessary at some point to
be able to deal with CSV strings, instead of a simple split on
commas, so that things like

     1, 2, 3, "ABC, Inc.", XYZ

returns

     array('1', '2', '3', 'ABC, Inc.', 'XYZ')

instead of

     array('1', '2', '3', '"ABC', 'Inc."', 'XYZ')

Pm




More information about the pmwiki-users mailing list