[pmwiki-users] (:template none:) ?

Hans design5 at softflow.co.uk
Mon Mar 31 13:26:11 CDT 2008


Monday, March 31, 2008, 4:47:36 PM, Pierre Racine wrote:

> I tried:

> (:template first:)
(:if equal {>>$Group} :)
> empty pagelist result
> (:if:)

> as suggested by PM in a older post but this doesn't seem to work.

you are right. A pagelist with no matches will return precisely
nothing.

There is a {$$PageCount} variable for use in pagelist templates, but
a) it must be used in template section (:template last:), and
b) if the count is zero it will not give any output.

I can only suggest the following kludge:
Using markup expression {(pagelist ... fmt=count)} will give you 0,
1, or exacty the number of pages. Use the same parameters for it as
for the normal pagelist, except the fmt=count parameter.
The markup expression is part of Cookbook:PowerTools

an example giving the number of pages as feedback, including 0:

(:pagelist group=XYZ fmt=#test:)
(:if equal {(pagelist group=XYZ  fmt=count)} 0:)No pages found!

[@
[[#test]]
(:template first:)
Results:
(:template each:)
* [[{=$FullName}]]
(:template last:)
(:if equal {$$PageCount} 1:)1 page found
(:else:){$$PageCount} pages found
(:ifend:)
[[#testend]]
@]


It is a kludge, because we have to run pagelist twice.
A (:template none:) markup would be nicer, but we have not got it.


  ~Hans




More information about the pmwiki-users mailing list