summaryrefslogtreecommitdiff
path: root/demos/blog/protected/Common/BlogDataModule.php
diff options
context:
space:
mode:
authorxue <>2006-05-30 17:30:40 +0000
committerxue <>2006-05-30 17:30:40 +0000
commitfd1c45c54585b020ef528586599a1fe56e9ee1f7 (patch)
tree296fc1df232024a8ec94bb61a22bff42ab050a23 /demos/blog/protected/Common/BlogDataModule.php
parent117813a0323e5669a2cd64598119fb81dd02e979 (diff)
Added recent comments portlet.
Diffstat (limited to 'demos/blog/protected/Common/BlogDataModule.php')
-rw-r--r--demos/blog/protected/Common/BlogDataModule.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/demos/blog/protected/Common/BlogDataModule.php b/demos/blog/protected/Common/BlogDataModule.php
index a15701ab..3dc71989 100644
--- a/demos/blog/protected/Common/BlogDataModule.php
+++ b/demos/blog/protected/Common/BlogDataModule.php
@@ -341,9 +341,22 @@ class BlogDataModule extends TModule
return $commentRecord;
}
+ public function queryComments($filter,$orderBy,$limit)
+ {
+ if($filter!=='')
+ $filter='WHERE '.$filter;
+ $sql="SELECT * FROM tblComments $filter $orderBy $limit";
+ $result=$this->query($sql);
+ $rows=sqlite_fetch_all($result,SQLITE_ASSOC);
+ $comments=array();
+ foreach($rows as $row)
+ $comments[]=$this->populateCommentRecord($row);
+ return $comments;
+ }
+
public function queryCommentsByPostID($id)
{
- $sql="SELECT * FROM tblComments WHERE post_id=$id";
+ $sql="SELECT * FROM tblComments WHERE post_id=$id ORDER BY create_time DESC";
$result=$this->query($sql);
$rows=sqlite_fetch_all($result,SQLITE_ASSOC);
$comments=array();