diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-07-22 12:31:16 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-07-22 12:31:16 -0400 |
commit | 42ac47915ba32abcf41d2718b9032e084a7f5f88 (patch) | |
tree | 54c9bd51dd2fda49b343b0a0f57d63aeeb5be4b8 /actions | |
parent | 9515303b14288041576c50c1729f874c2e17191f (diff) |
don't get a count from query
darcs-hash:20080722163116-84dde-3b17b13022b3d97483e911a99ebd23cc4b8da784.gz
Diffstat (limited to 'actions')
-rw-r--r-- | actions/all.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/actions/all.php b/actions/all.php index 944fec6d4..ca592a4eb 100644 --- a/actions/all.php +++ b/actions/all.php @@ -78,20 +78,22 @@ class AllAction extends StreamAction { $page = 1; } - list($cnt, $notice) = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); - if ($cnt > 0) { - common_element_start('ul', array('id' => 'notices')); - for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) { - if ($notice->fetch()) { - $this->show_notice($notice); - } else { - // shouldn't happen! - break; - } + common_element_start('ul', array('id' => 'notices')); + + $cnt = 0; + + while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) { + $cnt++; + + if ($cnt > NOTICES_PER_PAGE) { + break; } - common_element_end('ul'); + + $this->show_notice($notice); } + common_element_end('ul'); common_pagination($page > 1, $cnt > NOTICES_PER_PAGE, $page, 'all', array('nickname' => $profile->nickname)); |