diff options
-rw-r--r-- | actions/public.php | 3 | ||||
-rw-r--r-- | classes/Notice.php | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/actions/public.php b/actions/public.php index e0b2b1635..43beaffc6 100644 --- a/actions/public.php +++ b/actions/public.php @@ -60,7 +60,8 @@ class PublicAction extends StreamAction { function show_notices($page) { $cnt = 0; - $notice = Notice::publicStream($page); + $notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1); if ($notice) { common_element_start('ul', array('id' => 'notices')); diff --git a/classes/Notice.php b/classes/Notice.php index 5bf8a2de8..78ebc6aa5 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -290,7 +290,7 @@ class Notice extends Memcached_DataObject return $wrapper; } - function publicStream($page) { + function publicStream($offset=0, $limit=20) { $qry = 'SELECT * FROM notice '; @@ -300,7 +300,7 @@ class Notice extends Memcached_DataObject return Notice::getStream($qry, 'public', - ($page-1)*NOTICES_PER_PAGE, - NOTICES_PER_PAGE + 1); + $offset, $limit); +); } } |