[pmwiki-users] Pagelist with alternate formatting per item

Eemeli Aro eemeli at gmail.com
Thu Jun 10 04:32:34 CDT 2010


On 10 June 2010 12:06, Simon <nzskiwi at gmail.com> wrote:
> Of course there is not an "even" (or an "odd") conditional markup condition.
> Has anyone some suggestions on how I could achieve this?

1. Use CSS3 rules such as li:n-th-child(even) and/or
li:n-th-child(odd) [1]. Unfortunately, these don't work in IE [2].

2. Add the markup expression {(math)} [3], and then use the
conditional (:if equal 1 {(math {$$PageCount} % 2)}:)

3. Add a custom conditional:
    $Conditions['odd'] = 'intval($condparm) % 2';
and then use it: (:if odd {$$PageCount}:)

> PS what do you think about have an extension to pagelist for conditions, eg
> (:template if <markup expression> :)

Is there a use case where the same result can't be achieved with
already existing markup?

eemeli

[1] http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
[2] http://www.quirksmode.org/css/contents.html
[3] http://pmwiki.org/wiki/Cookbook/MarkupExpressionSamples#math



More information about the pmwiki-users mailing list