[pmwiki-users] Foxreplace syntax
randy at brownragfilms.com
Sun Jan 20 02:01:02 CST 2008
I have a challenge that seems ripe for Fox's powerful new string
replacement feature. Unfortunately, I haven't been able to figure out
the syntax for that feature and I can't find any code examples.
I want to put a form on a page that allows people to check one or more
groups and one or more pages. The form would look like:
[ ] GroupA
[ ] GroupB
[ ] Page1
[ ] Page2
[ ] Page 3
If someone checks all boxes, I would want output like this to replace
another section on the page that contains the form:
|GroupA.Page1 |GroupA.Page2 |GroupA.Page3
|GroupB,Page1 |GroupB.Page2 |GroupB.Page3
But if the user only checks GroupA, Page1, and Page3, I would want the
target section to contain:
This would all be easy if the form could restrict output to
permutations that contain both group and page. If that's possible, I
don't know how to do it.
In my trials, when the user selects all options, the output is what I
want. But if the user only selects GroupA, Page1, and Page3, I get:
|.Page1 |. |.Page3
I've thought maybe I could use foxreplace to delete any incomplete
strings to make it look better. But is there an easier way? And if
not, what is foxreplace's syntax to delete the incomplete strings? And
can that be done when the user presses submit, so I don't need to put
a <cleanup> button on the form to fix the results of <submit>?
I hope that makes sense.
More information about the pmwiki-users