Thanks for this extensive answer! It explains a lot of "behaviours" I observed. The markup output type would definitely be very useful to me. I find the synthax you propose straightforward.<br><br>Thanks,<br><br>
Benoit<br> <br><br><div><span class="gmail_quote">2007/3/27, Patrick R. Michaud <<a href="mailto:pmichaud@pobox.com">pmichaud@pobox.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Mar 27, 2007 at 11:33:55AM +0200, Benoit Dutilleul wrote:<br>> Dear all,<br>><br>> I've defined a pagelist template to output the number of entries of a<br>> query.<br>> [[#PageCount]]
<br>> (:if equal {>$Group}:){$$PageCount}(:ifend:)<br>> [[#PageCountend]]<br>><br>> However, when I use it, I have an unwanted carriage return.<br>><br>> Example:<br>> "You website has [template] numbers" outputs:
<br>><br>> Your website has 4<br>> members<br>><br>> Any idea how I can fix this?<br><br>First, a possibly "simple" answer:<br><br> [[#PageCount]]<br> (:template last:)<br> Your website has {$$PageCount} members
<br> [[#PageCountend]]<br><br>The long answer: The output of pagelist generally comes in a<br><div>...</div> wrapping, so that's probably what is causing the<br>linebreak in the output. And even if we can get rid of the <div>,
<br>the standalone "4" is still going to end up enclosed in its own<br>paragraph (<p>...</p>) so we'd still have some difficulty there.<br><br>The topic of inline pagelists recently came up in [1]... and at
<br>the conclusion of that thread we proposed adding a 'tag=' option<br>to specify 'div', 'span', or 'none' for the outer wrapping of<br>the pagelist template.<br><br>That takes care of the outer tag, but the inner (<p>) one
<br>still remains.<br><br>Today, in another message [2], we've also encountered a case<br>where someone wants (:pagelist:) to return the markup to its<br>enclosing page instead of rendering it directly to html. It would
<br>be good to support this option as well.<br><br>[1] <a href="http://thread.gmane.org/gmane.comp.web.wiki.pmwiki.user/39693/focus=40130">http://thread.gmane.org/gmane.comp.web.wiki.pmwiki.user/39693/focus=40130</a><br>[2]
<a href="http://www.pmichaud.com/pipermail/pmwiki-users/2007-March/040971.html">http://www.pmichaud.com/pipermail/pmwiki-users/2007-March/040971.html</a><br><br>So, instead of a 'tag=' option, I now propose an 'outputtype=' option:
<br><br> outputtype=div # return pagelist as <div>...</div> (current default)<br> outputtype=span # return as <span>...</span><br> outputtype=html # return as html, no outer wrapper
<br> outputtype=markup # return as markup (don't convert to HTML)<br><br>The above template to return a page count could then be done as:<br><br> [[#PageCount]]<br> (:template outputtype=markup:)<br> (:template last:)
<br> {$$PageCount}<br> [[#PageCountend]]<br><br>such that the pagecount ends up being inserted directly in the markup<br>(along with various carriage returns, that shouldn't result in<br>lines in the output).<br>
<br>Another option that avoids the template altogether is to write a custom<br>fmt=count option for pagelist to return the count. This would be:<br><br> function FPLCount($pagelist, &$matches, $opt) {<br> $matches = array_values(MakePageList($pagename, $opt, 0));
<br> return count($matches);<br> }<br><br> $FPLFormatOpt['count'] = array('fn' => 'FPLCount');<br><br>Then one could simply use (:pagelist fmt=count ...:) to return the<br>number of pages.
<br><br>Hope this helps!<br><br>Pm<br></blockquote></div><br>