[pmwiki-users] detect even and odd values of the {$$pagecount} variable

Martin Fick mogulguy at yahoo.com
Thu May 24 10:59:05 CDT 2007


--- noskule <noskule at gmx.net> wrote:
> noskule schrieb:
> > is it somehow possible to detect even and odd
> values of the pagecount variable
> like:
> 
> (:if equal {$$pagecount}/2 "rest 0"  :)
> (:cell bgclolor=#eee:)
> (:else:)
> (:cell:)
> 
> 
> > 
> > I'm trying to build tables that tr's have 2
> different background colors

You can use this snippet from the original
PageListTemplates recipe:

$Conditions['divisible'] =
'DivisibleCondition($condparm)';

function DivisibleCondition($condparm) {
  $args = ParseArgs($condparm);
  return @(($args[''][0] % $args[''][1]) == 0);
}

to setup a special conditional for that.  


You will still have the problem of getting rows to
look nice if there is any spacing between cells since
your template only sets the bg color on the cells, not
the entire row.  There is a PITS for this:

http://www.pmwiki.org/wiki/PITS/00634


On the pmwiki site, a nice effect is achieved here:
http://www.pmwiki.org/wiki/Cookbook/Administration

using the template here:
http://www.pmwiki.org/wiki/Cookbook/RecipeList

[#recipelist]]
(:template defaults list=recipes class=recipelist:)
(:template first:)
||cellspacing=0 width=100%
||!Name        ||!Summary     ||!Rating ||
(:template each:)
||[[{=$Name}]] ||{=$:Summary} &nbsp; (:if ! equal
{=$:Version}:)[-(version: {=$:Version})-](:ifend:)
||[-{=$Rating}-] ||
[[#recipelistend]] 

but I'm not sure how?  I'm guessing that
class=recipelist has a special definition somewhere
that does this using the class='indn' put on each tr?
I you look at the html source, the trs are numbered
from ind1 to ind4 "<tr class='ind1'>", I don't know
how this is achieved either?

-Martin



      ____________________________________________________________________________________Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 





More information about the pmwiki-users mailing list