Forums / Developer / Problems when using ezcomments

Problems when using ezcomments

Author Message

Lars Eirik R

Tuesday 14 September 2010 5:45:12 am

Hi.

I need to present the latest comments which have been added to the system. I would not like to sort results based on contentobjectids and this should all be possible by using ezcomFunctionCollection::fetchCommentListByContentObjectIDList(null,null,null,null,null,null,0,100,array());

When I do this however i only get an empty result back.

it also produces an sql query error.

Is anyone able to reproduce this?

I am running ezcomments v 1.1 (the function was not available in preveious releases.)

Update 1: I managed to get the fetch function to work, but only when used as a template fetch on my 4.4beta3 installation of eZPublish.

I now made the extension work for ezPublish 4.2 as well:)

Any one who can help me out with an example of calling the fetchCommentListByContentObjectIDList which fetches all comments regardless of user or contentobjectid?

Update 2: I tried to use the fetchLatestComments instead as a funciton in php and this seems to work as i was hoping:)

Chen Xiongjie

Tuesday 14 September 2010 1:08:22 pm

Hi, Lars,

The fetch functions were designed to be used in template, so it will be safe to use them in template.

But if you try to use fetchCommentListByContentObjectIDList in php, I think the problem is that the sortby field missing(which can be seen as a inconvenient issue :) ). So if you use fetchCommentListByContentObjectIDList(null,null,null,null,'modified',null,0,100,array()), it should work.

But still fetch function in template is recommended.

Documentation: http://ez.no/doc/extensions/ez_comments/setup_and_user_guide_1_1/template_fetch_functions/comment_list_by_content_list

Thanks.

Chen

eZ Comments: http://projects.ez.no/ezcomments
twitter: http://twitter.com/xiongjie

Lars Eirik R

Tuesday 14 September 2010 2:06:15 pm

Thanks for responding Chen!

I have not used the fetchCommentLIstByContentObjectIDList after encountering the problem of calling it from php.. Also i have successfully been using fetchLatestComments:)

I will try to use the other function just to test if it works with adding the sortby field:)

Once again, thanks

Bayron Guevara

Monday 27 September 2010 10:57:31 pm

Hello Lars,

As Jerom said, you can call a fetch function from PHP as easier as inside a template. Just make a call to eZFunctionHandler::execute with the appropiate parameters. In your case it would be something like:

eZFunctionHandler::execute('comment', 'comment_list_by_content_list', array(
  'sort_field' => 'modified',
  'sort_order' => 'desc'
));

Web Developer & Modern Philosopher
Visit http://www.laprensa.hn, http://www.diez.hn, http://www.estilo.hn