coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: lasa on November 15, 2003, 07:43:31 PM

Title: last 10 comments
Post by: lasa on November 15, 2003, 07:43:31 PM
Hi,

How can I display the last 10 comments in text-only on a non-coppermine page? Just on the homepage, so the visitors can see the latest actions, and click on it.

Laurens.
Title: last 10 comments
Post by: DJMaze on November 15, 2003, 08:40:50 PM
run a SQL query on the cpg_comments table and in that query add "ORDER BY msg_date DESC" then retrieve the first X rows where X is the total you want to show.

example:$sql = "SELECT msg_author, msg_body, msg_date FROM cpg_comments ORDER BY msg_date DESC LIMIT 10";
$result = $db->sql_query($sql);
while ($value = $db->sql_fetchrow($result)) {
    echo $value['msg_body'] . " by " . $value['msg_author] . " on " . $value['msg_date'] . "<br>";
}
Title: Thnx!
Post by: lasa on November 15, 2003, 10:26:55 PM
Thnx very much, after a little bit modifying, it works now.
Do you know how I can let the comment link to the concerned photo?

Laurens.
Title: last 10 comments
Post by: Joachim Müller on November 16, 2003, 11:25:39 AM
[list=1]
Title: last 10 comments
Post by: lasa on November 16, 2003, 11:30:28 AM
1. Sorry for that.
2. I want to expand this feature. So I have to create for every issue of this feature an new topic?
3. Thnx for moving the topic...