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

Dominique Faure dominique.faure at gmail.com
Wed May 9 14:27:19 CDT 2007


On 5/9/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> 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')
>

so, why not directly targeting "standards" like JSON [1]?

Dominique

[1] http://en.wikipedia.org/wiki/JSON



More information about the pmwiki-users mailing list