[pmwiki-users] PAGELIST / Wikiform PTV List Search

Petko Yotov 5ko at 5ko.fr
Sat Jul 25 05:47:26 CDT 2009


On Friday 24 July 2009 15:18:02 edwin marte wrote:
> There are a few ones where I use checkboxes so what I then have is
> something like this:    :variable: opt1,opt2,opt3
>
> I need no to do is to make a pagecount for these variables with checkboxes.
> I have not been able to make an accurate count yet. It should be easy,
> probably somebody else hade done already and could give me some hints.
>
> Here is my pagelist to produce a simple Pagecount
>
> (:if false:)
> [[#template]]
> (:template first:)
> (:template each:)
> (:template last:)
> {$$ PageCount}
> [[#templateend]]
> (:if:)

Hi. If you only need to produce a number, use the built-in, faster "fmt=count" 
instead of fmt=#template.

> How can I make the pagelist to count the pages for any combination of the
> options (opt1 only, opt2 Only, opt1 and opt2, opt3 and opt1 , etc) ?

1. Values starting with "-" are always excluded, like:

   $:Var=-Opt1    -- the value of :Var: is not "Opt1"
    -- counts :Var:Opt1,Opt2   but not    :Var:Opt1

   $:Var=-*Opt1*  -- the value of :Var: does not contain "Opt1"
    -- counts neither :Var:Opt1,Opt2   nor   :Var:Opt1


2. A comma means inclusive OR, except for 1. above.

  $:Var=Opt1
   -- counts   :Var:Opt1   but not    :Var:Opt1,Opt2

  $:Var=*Opt1*
   -- counts   :Var:Opt1   and    :Var:Opt1,Opt2

  $:Var=Opt1,Opt2 
   -- counts   :Var:Opt1   and   :Var:Opt2   but not  :Var:Opt1,Opt2

  $:Var=*Opt1*,*Opt2*
   -- counts   :Var:Opt1   and   :Var:Opt2  and  :Var:Opt1,Opt2,Opt3

  $:Var=*Opt1*,*Opt2*,-*Opt3*
   -- counts   :Var:Opt1  and  :Var:Opt1,Opt2  but not  :Var:Opt2,Opt3

  $:Var=*Opt1*Opt2*,*Opt2*Opt1*  -- contains both Opt2 and Opt1
   -- counts   :Var:Opt1,Opt2  and  :Var:Opt2,Opt1 and :Var:Opt2,Opt3,Opt1

Thanks,
Petko




More information about the pmwiki-users mailing list