Add note to serendipity_fetchEntries().
I think that will help to think about the context of serendipity_fetchEntries() calls. Closes #693. Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
93ba22c8d4
commit
9b65e717c1
@ -407,6 +407,19 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
|
||||
if (!empty($limit)) {
|
||||
if (isset($serendipity['GET']['page']) && ($serendipity['GET']['page'] > 1 || serendipity_db_bool($serendipity['archiveSortStable'])) && !strstr($limit, ',')) {
|
||||
|
||||
// serendipity_fetchEntries() is mostly called in page context to
|
||||
// deliver a list of entries to display on archive, search result
|
||||
// or other pages, where $limit means the number of entries to
|
||||
// display on each page. This code depends on that notion,
|
||||
// catches request for non-existing pages and applies
|
||||
// pagination.
|
||||
// If you don't work in a page context, e.g. you just want to fetch
|
||||
// a list of entries to display in a sidebar, you should think
|
||||
// about saving and unsetting $serendipity['GET']['page'] before
|
||||
// calling serendipity_fetchEntries() and reset it to the saved
|
||||
// value afterwards.
|
||||
// See https://github.com/s9y/Serendipity/issues/693 for context.
|
||||
|
||||
$totalEntries = serendipity_getTotalEntries();
|
||||
$totalPages = ceil($totalEntries / $limit);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user