Thanks for this extensive answer! It explains a lot of &quot;behaviours&quot; 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>&nbsp;<br><br><div><span class="gmail_quote">2007/3/27, Patrick R. Michaud &lt;<a href="mailto:pmichaud@pobox.com">pmichaud@pobox.com</a>&gt;:</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>&gt;&nbsp;&nbsp;&nbsp;&nbsp;Dear all,<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;I&#39;ve defined a pagelist template to output the number of entries of a<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;query.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;[[#PageCount]]
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;(:if equal {&gt;$Group}:){$$PageCount}(:ifend:)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;[[#PageCountend]]<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;However, when I use it, I have an unwanted carriage return.<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;Example:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&quot;You website has [template] numbers&quot; outputs:
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;Your website has 4<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;members<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;Any idea how I can fix this?<br><br>First, a possibly &quot;simple&quot; answer:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;[[#PageCount]]<br>&nbsp;&nbsp;&nbsp;&nbsp;(:template last:)<br>&nbsp;&nbsp;&nbsp;&nbsp;Your website has {$$PageCount} members
<br>&nbsp;&nbsp;&nbsp;&nbsp;[[#PageCountend]]<br><br>The long answer: The output of pagelist generally comes in a<br>&lt;div&gt;...&lt;/div&gt; wrapping, so that&#39;s probably what is causing the<br>linebreak in the output.&nbsp;&nbsp;And even if we can get rid of the &lt;div&gt;,
<br>the standalone &quot;4&quot; is still going to end up enclosed in its own<br>paragraph (&lt;p&gt;...&lt;/p&gt;) so we&#39;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 &#39;tag=&#39; option<br>to specify &#39;div&#39;, &#39;span&#39;, or &#39;none&#39; for the outer wrapping of<br>the pagelist template.<br><br>That takes care of the outer tag, but the inner (&lt;p&gt;) one
<br>still remains.<br><br>Today, in another message [2], we&#39;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.&nbsp;&nbsp;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 &#39;tag=&#39; option, I now propose an &#39;outputtype=&#39; option:
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;outputtype=div&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# return pagelist as &lt;div&gt;...&lt;/div&gt; (current default)<br>&nbsp;&nbsp;&nbsp;&nbsp;outputtype=span&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # return as &lt;span&gt;...&lt;/span&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;outputtype=html&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # return as html, no outer wrapper
<br>&nbsp;&nbsp;&nbsp;&nbsp;outputtype=markup&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # return as markup (don&#39;t convert to HTML)<br><br>The above template to return a page count could then be done as:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;[[#PageCount]]<br>&nbsp;&nbsp;&nbsp;&nbsp;(:template outputtype=markup:)<br>&nbsp;&nbsp;&nbsp;&nbsp;(:template last:)
<br>&nbsp;&nbsp;&nbsp;&nbsp;{$$PageCount}<br>&nbsp;&nbsp;&nbsp;&nbsp;[[#PageCountend]]<br><br>such that the pagecount ends up being inserted directly in the markup<br>(along with various carriage returns, that shouldn&#39;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.&nbsp;&nbsp;This would be:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;function FPLCount($pagelist, &amp;$matches, $opt) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$matches = array_values(MakePageList($pagename, $opt, 0));
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return count($matches);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;$FPLFormatOpt[&#39;count&#39;] = array(&#39;fn&#39; =&gt; &#39;FPLCount&#39;);<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>