Jump to content

Global access to all comments


gerritvanaaken
 Share

Recommended Posts

Hi there!

I need to gather a list of all comments, regardless of the parent page of each comment. Is there a global $comments object, which can do this? Something like:

foreach($comments->find('sort=-created') as $comment) {
// show comment
}

I did not find anything similar in the forums. Can someone help me?

Link to comment
Share on other sites

I came up with a pretty "close-to-the-metal" solution. Not perfect, but seems to work:

$comments = $database->query('SELECT * FROM field_comments ORDER BY created DESC');
foreach($comments as $c) {
  // $c is an array with raw database values of those comments
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...