[pmwiki-users] Conditional Markup enhancement
Dominique Faure
dominique.faure at laposte.net
Wed Mar 2 01:08:36 CST 2005
At Wednesday, March 02, 2005 12:45 AM [GMT+1=CET], Patrick R. Michaud wrote:
> In the new version you can still do this:
>
> $arg = ParseArgs($x);
> if ($arg['xyz']) ... // xyz=something was specified
>
> > or even better, if I provide defaults
> > $argdefaults['this'] = 0;
> > $args = GetDirectiveArgs($args,$argdefaults)
>
> $argdefaults['this'] = 0;
> $arg = array_merge($argdefaults, ParseArgs($x));
>
> And if you're wanting to have +"value" and -"value" come
> back as a one or a zero (indicating "on" and "off"):
>
> $arg = ParseArgs($x);
> foreach((array)$arg[''] as $a) $arg[$a]=1;
> foreach((array)$arg['+'] as $a) $arg[$a]=1;
> foreach((array)$arg['-'] as $a) $arg[$a]=0;
>
> if ($arg['xyz']==0) ... // either -xyz or xyz=0
> if ($arg['xyz']==1) ... // either +xyz or xyz=1
> if (isset($arg['xyz'])) ... // xyz was specified somewhere
>
> > I think the multiple occurence of a parameter in a call can't be solved
> > by any of both solutions.
>
> I think this pretty much handles the cases we'd need
> to worry about.
>
Could you please post here the code of your ParseArgs function then we could
try and understand ourself, thanks.
Dom
More information about the pmwiki-users
mailing list