[pmwiki-devel] how to access MatchCount from pagelist
DaveG
pmwiki at solidgone.com
Thu Feb 12 16:30:27 CST 2009
I managed to do this for Blogger, but it involved some work outside of
the pagelist, inside blogger.php, and also some conditional markup to
show/hide the prev/next links. Details below.
It works, except where the last page contains exactly the number of
entries as the size of the page range. In that case it shows a link to
the next page, and that page is empty. Adding a pagelist (:template
none:) would resolve this.
~ ~ David
Details for Solution
The url will contain the page number to be displayed.
$Blogger_EntriesPerPage defined the number of entries to show per page.
$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) * (isset($_GET['count'])
?$_GET['count'] :$Blogger_EntriesPerPage)) + 1;
$FmtPV['$Blogger_EntryEnd'] =
$FmtPV['$Blogger_EntryStart'] + (isset($_GET['count'])
?$_GET['count'] :$Blogger_EntriesPerPage) - 1;
Pagelist would contain:
(:template last:)
(:include page-navigation pagecount={$$PageCount} pagenav={$$pagenav}
perpage={$$perpage}:)
Included from pagelist. Refer to blogger.php for markups expressions.
#page-navigation
Parameters: pagecount, pagenav, perpage
[@
(:if false:)[[#page-navigation]](:ifend:)
(:if !equal "{$$pagenav}" false:)(:div class="page-navigation":)\
(:if !equal "{$Blogger_PagePrev}" "":)\
%previous-entries%[[{(b_url {*$FullName} page {$Blogger_PagePrev})} |
$[newer posts]]]\
(:ifend:)\
(:if equal {earlymx(b_lt "{$$pagecount}" (b_ifnull "{$$perpage}"
"{$Blogger_EntriesPerPage}"))} false:)\
%next-entries%[[{(b_url {*$FullName} page {$Blogger_PageNext})} |
$[older posts]]]\
(:ifend:)
(:divend:)
(:ifend:)
[[#page-navigationend]]
@]
More information about the pmwiki-devel
mailing list