[pmwiki-users] site index

Roman romat2 at gmail.com
Fri Oct 26 11:40:19 CDT 2007


On 10/26/07, Maria McKinley <parody at u.washington.edu> wrote:
> On 10/26/07, Roman <romat2 at gmail.com> wrote:
> > > You could do some kind of column spliting by adding a modulo function
> > > to MarkupExpr. In your config.php, just add:
> > >
> > >   $MarkupExpr['mod'] = '($args[0] % $args[1])';
> > >
> > > Then, define a pagelist template such as:
> > >
> > >   [[#threecols]]
> > >   (:template first:)
> > >   (:table:)
> > >   (:template each:)
> > >   (:if equal 1 {(mod {$$PageCount} 3)}:)
> > >   (:cellnr:)[[{=$FullName}]]
> > >   (:else:)
> > >   (:cell:)[[{=$FullName}]]
> > >   (:if:)
> > >   (:template last:)
> > >   (:tableend:)
> > >   [[#threecolsend]]
> > >
> > > That you may use this like below:
> > >
> > >   (:pagelist group=PmWiki fmt=#threecols:)
> > >
> > > For the record, the 'mod' function is now already available in latest
> > > MarkupExprPlus recipe.
> > > --
> > > Dominique
> >
> > Good idea, but for my taste too many table cells. It would be fine if
> > PmWiki could have something like {$$TotalPageCount} in pagelists,
> > probably defined in (:template first:) section. Then we could define
> > pagelist template this way (with only 3 cells):
> >
> > [[#threecols]]
> > (:template first:)
> > (:gettotalpagecount:)
> > (:table:)
> > (:cellnr:)
> > (:template each:)
> > (:if equal 1 {(ColumnBreak {$$PageCount} {$$TotalPageCount} 3)} :)
> > (:cell:)[[{=$FullName}]]
> > (:else:)
> > [[{=$FullName}]]
> > (:if:)
> > (:template last:)
> > (:tableend:)
> > [[#threecolsend]]
> >
> > where ColumnBreak is defined as
> > $MarkupExpr['ColumnBreak'] = '($args[0] % ($args[1] / $args[2]))';
> >
> > Roman
> >
>
> It looks like fmt=#count was constructed to count the pages
> (http://www.pmwiki.org/wiki/Site/PageListTemplates). Could we use this
> to figure out the column break?
>
> cheers,
> maria
>

Yes, but it is only for standalone usage, not for usage in pagelist
definition. If you somehow filter your pagelist, e.g. (:pagelist
#threecols group=SomeGroup :), you would have to pass that filter to
pagelist for counting pages.

Roman



More information about the pmwiki-users mailing list