The "if" rule occurs fairly early on, during "fulltext" processing. The "pagelist" rule fires much later, during "directive" processing. Thus the pagelist results are not available at the time the conditional is evaluating them.<br>
<br>One possibility would be to create another pagelist markup which fired earlier:<br><br>Markup('earlypagelist', '<if',<br> '/\\(:earlypagelist(\\s+.*?)?:\\)/ei',<br> "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('$1 ')))");<br>
<br>Then in your page source you would do something like this:<br><br><span style="font-family: 'Lucida Grande'; font-size: 13px; white-space: pre-wrap;">"(:pagel</span>lter<span style="font-family: 'Lucida Grande'; font-size: 13px; white-space: pre-wrap;">ist group=null fmt=count:)"<br>
(:if equal "(:earlypagelist group=null fmt=count:)" "0":)<br>This pagelist has zero results.<br>(:ifend;)<br><br>Any existing pagelists would continue to be served by the normal (:pagelist:) markup, but you could use this (:earlypagelist..:) whenever you needed to compare the results using a conditional.<br>
<br></span>Another possibility would be to use markup expressions and the pagelist found in powertools.<br><br>Probably the best alternative is Hans's new fpltemplate recipe (the status is still experimental, but it's been pretty solid in my testing). It gives a (:template none:) option you can put in your pagelist formatting template as well as exposing a <code class="escaped">{$$PageListCount} <font style="font-family: arial,helvetica,sans-serif;" size="2">variable for use in templates.</font></code><br>
<br>-Peter<br><br><div class="gmail_quote">2009/3/28 Randy Brown <span dir="ltr"><<a href="mailto:randy@brownragfilms.com">randy@brownragfilms.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><span style="font-family: 'Lucida Grande'; font-size: 13px; white-space: pre-wrap;">I'd like to test whether a pagelist will yield results. If I use this markup:
"(:pagelist group=null fmt=count:)"
(:if equal "(:pagelist group=null fmt=count:)" "0":)
This pagelist has zero results.
(:ifend;)
only "0" displays, not "This pagelist has zero results."
Is there a way to use a page count in a conditional?</span><div><font face="'Lucida Grande'" size="3"><span style="font-size: 13px; white-space: pre-wrap;"><br></span></font></div><font color="#888888"><div><font face="'Lucida Grande'" size="3"><span style="font-size: 13px; white-space: pre-wrap;">Randy</span></font></div>
</font></div><br>_______________________________________________<br>
pmwiki-users mailing list<br>
<a href="mailto:pmwiki-users@pmichaud.com">pmwiki-users@pmichaud.com</a><br>
<a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users" target="_blank">http://www.pmichaud.com/mailman/listinfo/pmwiki-users</a><br>
<br></blockquote></div><br>