Update of /cvsroot/php-blog/serendipity/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30705/include
Modified Files:
functions_entries.inc.php
Log Message:
- Fix paging and simplify the paging function
- When using paging, use the rewrite rules to make sexy pages /P[n].html
TODO: Fix header title when browsing frontpage pages
Index: functions_entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/functions_entries.inc.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- functions_entries.inc.php 11 Dec 2004 14:39:43 -0000 1.22
+++ functions_entries.inc.php 13 Dec 2004 12:29:00 -0000 1.23
@@ -450,48 +450,33 @@
return $search;
}
-/** Print a footer below the list of entries
- *
- **/
function serendipity_printEntryFooter($short_output = false) {
-global $serendipity;
-
- if (!$short_output) {
- // build the query string with variables we want to carry from each page to page
- $add_query = '';
- if (is_array($serendipity['GET'])) {
- $page_get_array = $serendipity['GET'];
- if ((isset($serendipity['GET']['calendarZoom']) && isset($serendipity['GET']['range']) && $serendipity['GET']['calendarZoom'] == $serendipity['GET']['range'])
- || (!isset($serendipity['GET']['calendarZoom']) && $serendipity['GET']['action'] != 'read')) {
- // The 'range' variable is always set by the layout.php, even if we didn't specify one. But to still be able to paginate through ALL entries, we need to not propagate this variable in special cases where s9y automatically sets the 'range' variable.
- unset($page_get_array['range']);
- }
+ global $serendipity;
- unset($page_get_array['page']);
- unset($page_get_array['action']);
- unset($page_get_array['adminAction']);
+ if ($short_output) {
+ return;
+ }
- foreach($page_get_array AS $skey => $sval) {
- $add_query .= '&serendipity[' . urlencode($skey) . ']=' . urlencode($sval);
- }
- }
+ $totalEntries = serendipity_getTotalEntries();
+ $totalPages = ceil($totalEntries / $serendipity['fetchLimit']);
- $totalEntries = serendipity_getTotalEntries();
- $totalPages = ceil($totalEntries / $serendipity['fetchLimit']);
+ if (!isset($serendipity['GET']['page'])) {
+ $serendipity['GET']['page'] = 1;
+ }
- if (!isset($serendipity['GET']['page'])) {
- $serendipity['GET']['page'] = 1;
- }
- if ($serendipity['GET']['page'] > 1) {
- $serendipity['smarty']->assign('footer_prev_page', $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[page]=' . ($serendipity['GET']['page'] - 1) . $add_query);
- }
+ if ($serendipity['GET']['page'] > 1) {
+ $uriArguments = $serendipity['uriArguments'];
+ $uriArguments[] = 'P'. ($serendipity['GET']['page'] - 1);
+ $serendipity['smarty']->assign('footer_prev_page', serendipity_rewriteURL(implode('/', $uriArguments) .'.html'));
+ }
- $serendipity['smarty']->assign('footer_info', sprintf(PAGE_BROWSE_ENTRIES, $serendipity['GET']['page'], $totalPages, $totalEntries));
+ $serendipity['smarty']->assign('footer_info', sprintf(PAGE_BROWSE_ENTRIES, (int)$serendipity['GET']['page'], $totalPages, $totalEntries));
- if ($serendipity['GET']['page'] < $totalPages) {
- $serendipity['smarty']->assign('footer_next_page', $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[page]=' . ($serendipity['GET']['page'] + 1) . $add_query);
- }
+ if ($serendipity['GET']['page'] < $totalPages) {
+ $uriArguments = $serendipity['uriArguments'];
+ $uriArguments[] = 'P'. ($serendipity['GET']['page'] + 1);
+ $serendipity['smarty']->assign('footer_next_page', serendipity_rewriteURL(implode('/', $uriArguments) .'.html'));
}
}
|