diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-07-07 03:05:45 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-07-07 03:05:45 -0400 |
commit | 14fa99eab5750b7d5b2598060b118c8f82deb01a (patch) | |
tree | 347e19c1891e4dcd40e719b35fc7eb929cd996e6 | |
parent | b9eedf6195d64f8c8904fdfd99ae528f1063af4b (diff) |
UNDO: use DB_DataObject join
darcs-hash:20080707070545-84dde-8034bf485a182ac86295c9a7831cfabac3cb2b55.gz
-rw-r--r-- | actions/replies.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/actions/replies.php b/actions/replies.php index 9b9da8cbe..ce12b4d9f 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -68,20 +68,27 @@ class RepliesAction extends StreamAction { function show_replies($profile) { $reply = new Reply(); - $notice = new Notice(); $reply->profile_id = $profile->id; + $reply->orderBy('modified DESC'); + $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; + $reply->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); - $reply->joinAdd($notice, 'INNER', NULL, 'notice_id'); - + $cnt = $reply->find(); if ($cnt > 0) { common_element_start('ul', array('id' => 'notices')); for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) { if ($reply->fetch()) { + $notice = new Notice(); + $notice->id = $reply->notice_id; + $result = $notice->find(true); + if (!$result) { + continue; + } $this->show_notice($notice, $reply->replied_id); } else { // shouldn't happen! |