[pmwiki-users] ZAP checklist for categories

The Editor editor at fast.st
Thu Nov 16 13:41:06 CST 2006


On 11/12/06, Jiri <mail at revida.sk> wrote:
>
> I really don,t know how to test "text variable for that page (on/off)"
> and I tried a lot.
> There is a category list only like
>
> tags="[[!1994]] | [[!2006]] | [[!Akcie]] | [[!Clanky]]"
>
> in text variables
> and I think there is no conditional markup
> to test "text1 is contained in text2"
> Or is there? Then it would be very easy.
>
> Really, I miss string comparision functions in PmWiki (except "equal")
> There is the "if match" condition described in
> http://www.pmwiki.org/wiki/Cookbook/ConditionalMarkupSamples
> but as a nonPHPcoder I am not ready to use it
> unless I start to study PHP manuals.
>
> Would you help me?


Ahhh, a great new idea!  Better than the ZAParray markup I had in
mind. The next version of ZAP will have a built in "inlist"
conditional that I needed for ZAPchat, but I made it more
multipurpose, as ZAP uses csv lists extensively...  It makes possible
something like the following:

(:if inlist page=Chatrooms.{$$room} list=adminlist item={=$:Member}:)

But you could just as easily put this in a pagelist template,

(:if inlist page=Group.Name list=categorylist item={=$Name}:)
(:checkbox ... checked:)\\
(:if ! inlist ... )
(:checkbox... )\\   (not checked)
(:ifend:)

Then you would have to make a page for each item in the checklist,
example:  Checklist.Alpha, Checklist.Beta, Checklist.Gamma, etc. (to
use the example from the array snippet.  Then call the pagelist
group=Checklist with the template above and see what happens.  You can
also use the new $$option field very effectively for this kind of
thing.

Below is the code you need to add to your zap recipe if you want to
experiment now, or wait for the next version release.

//ZAP CONDITIONALS
$Conditions['inlist'] = 'InList($condparm)';
function InList($x) {
	$arg = ParseArgs($x);
	$item = $arg[item];
  	$l = explode(",", ZAPgetdata("$arg[list]", "$arg[page]"));
	foreach ($l as $ll) {
		if (strcmp($ll, $item) == 0) return true;
		}
	return false;
	}


I'm really going to have to cut back some on my involvement with this
as I'm getting behind on some other things.  But will try to help when
I can.

Cheers,
Caveman




More information about the pmwiki-users mailing list