[pmwiki-devel] ZAP chaining commands...

The Editor editor at fast.st
Sun Mar 25 08:39:01 CDT 2007


I've been tinkering with ZAP to find a way to reassign values from one
field to another after they are processed, and I found a simple way to
do it by just rewriting one line of code.  However, I'd like to be
able to change the pattern matching process to improve the syntax.

Currently, if you put

field1={field2}

the contents of field2 are inserted into field1 before the engine
processes a single field.  So if I want to say do something like

php_1=substr|{field2},2,5

it will do what is expected.  However if I have:

php_1=substr|{field2},2,5
field1={php_1}

you will get the value of php_1 before it executes the substr, and not
the value you want, after it is executed.

On my test version I have it working so that I can add spaces like
this and it does what I want:

php_1=substr|{field2},2,5
field1={ php_1 }

This is ok but I'd prefer a syntax like {{php_1}} for the delayed
field replacement. Yet, I can't get that to work because when I try
it, it does the field replacement for the string on the inside braces.

So in short, is there some way to the following so it matches with
{php_1} but fails with {{php_1}}.

preg_replace('/\\{(\\w+)\\}/e', 'ZAPfieldreplace("$1", $ZAParray)', $value);

Otherwise I'll just use the extra spaces syntax, or perhaps another
syntax can be suggested...

Cheers,
Dan



More information about the pmwiki-devel mailing list