PDA

View Full Version : all comments on one page


horix
11-24-2004, 07:38 AM
wondering if there is a quick/easy way to do this? assuming there is some while loop i can put somewhere that will grab all comments from an image and repeat that to get all comments from all images? with some formatting tags thrown in this could be a powerful function to add...? if someone wants to give me the general tags or where to look im sure i could figure it out, just not really sure where to start!

thanks, horix - galexkeene.wornpath.net

Connie
11-24-2004, 08:16 AM
I think this topic is on the way already

I assume you want to see all the comments in the admin-area? In the "public area" their are shown already ;=)

pixelpunk
11-24-2004, 08:22 AM
I am not exactly sure what you want to accomplish. But to print out all comments from the blog you can do something like this.
<?php

$addon_name = "Grab all comments";
$addon_description = "Will print out all the comments from the blog.
";
$addon_version = "0.1";

if($_GET['x'] == "grabcomments") {
// will print out all comments from the blog ordered by newest first and oldest last
$cquery = mysql_query("select parent_id, datetime, message, name, url from ".$pixelpost_db_prefix."comments order by id desc");
while(list($comment_parent,$comment_datetime, $comment_message, $comment_name, $comment_url) = mysql_fetch_row($cquery)) {
// all comments, do stuff
echo "
$comment_datetime<br />
$comment_message<br />
<a href='$comment_url' target='_blank' title='Visit website'>$comment_name</a>
<hr />
";
} // end while loop
exit;
} // end grabcomments

?>

This will work, however you obviously need more formatting and stuff if you want it as a separate page. You could also hook it up with a custom template if you wish. But this is a basic writeup to show you how it can be done, this is as an addon.

Put this in a file, upload to your addons directory and call it with index.php?x=grabcomments

// punk

horix
11-24-2004, 10:29 AM
cant seem to get this working.. did a read over myself but i dont know enough php or about pixelpost to troubleshoot... can you do a quick proof? thanks!

pixelpunk
11-24-2004, 12:27 PM
grab it here (http://www.pixelpunk.se/software/releases/grab_comments.php.zip)

Probably just gremlins when copy/pasting from the web.

demosite (http://www.pixelpunk.se/software/demo/?x=grabcomments)

// punk