[pmwiki-users] Paging in pagelists

DaveG pmwiki at solidgone.com
Fri Jan 23 18:49:52 CST 2009

Here's what I've done for Blogger. I include a section after the 
pagelist which adds a link for previous/next, and includes a "page" 
(:div class="page-navigation":)(:if !equal "{$Blogger_PagePrev}" 
"":)%previous-entries%[[{*$FullName}?page={$Blogger_PagePrev} | $[newer 
(:if equal "{earlymx(lt "{$$PageCount}" "{$Blogger_EntriesPerPage}")}" 
"false":)%next-entries%[[{*$FullName}?page={$Blogger_PageNext} | $[older 

And in config.php (or in my case, blogger.php) I add the calculations 
for the previous and next links, based on the paramater set from the 
links above:
$Blogger_EntriesPerPage = 8;
$FmtPV['$Blogger_PageNext'] =
   (isset($_GET['page']) ? $_GET['page']+1 : 2);
$FmtPV['$Blogger_PagePrev'] =
   (isset($_GET['page']) && ($_GET['page']>0) ? $_GET['page']-1 : 0);
$FmtPV['$Blogger_EntryStart'] =
   (($FmtPV['$Blogger_PageNext']-2) * $Blogger_EntriesPerPage) + 1;
$FmtPV['$Blogger_EntryEnd'] =
   $FmtPV['$Blogger_EntryStart'] + $Blogger_EntriesPerPage - 1;

In order to access {$$PageCount}, you'll need a markup which processes 
markup expressions earlier in the processing loop:
Markup('{earlymx(', '>{$var}', '/\\{earlymx(\\(\\w+\\b.*?\\))\\}/e',
	"MarkupExpression(\$pagename, PSS('$1'))");

And next, a markup expression to calculate 'less than':
$MarkupExpr['lt'] = '($args[0]<$args[1]?"true":"false")';

This only shows a previous link, if we're not at the start, and only 
shows the next link if we've filled the page with the maximum number of 

Note, that this will show an 'older posts' link we're on the last page, 
but the number of entries on the page equals EntriesPerPage. I don't see 
a way past this right now, so the user will see an empty page when 
clicking 'older posts' in this case. Adding a (:template none:) markup 
will help in this case.

I pretty much ripped this out of Blogger, and haven't tested it 
stand-alone, but it should work.

  ~ ~ Dave

pmwiki at 911networks.com wrote:
> Hi,
> I have searched the mailing list and have not found an answer. I'm
> looking for a way of paging a pagelist:
> I'm using:
> (:pagelist group=-Site*,-PmWiki*,-Main* fmt=#lnews count=15 order=-time:)
> #lnews is defined to display the first 4 lines of the pages.
> I'd like to page the whole list paged 15 entries at a time, so at the
> bottom of the page there would be next 15 entries, previous 15
> entries.
> Any suggestion?

More information about the pmwiki-users mailing list