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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 00:56:09
Script start
Timing: Jan 30 2025 00:56:09
Module start 'layout'
Timing: Jan 30 2025 00:56:09
Module start 'content'
Timing: Jan 30 2025 00:56:09
Module end 'content'
Timing: Jan 30 2025 00:56:09
Script end

Main resources:

Total runtime0.0143 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.1328151.2109
Module start 'layout' 0.00500.0024 739.343836.6484
Module start 'content' 0.00740.0054 775.992294.1719
Module end 'content' 0.01280.0014 870.164133.9922
Script end 0.0143  904.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002215.3621140.0002
Check MTime0.00106.7488140.0001
Mysql Total
Database connection0.00085.396710.0008
Mysqli_queries0.002416.881230.0008
Looping result0.00000.083510.0000
Template Total0.00117.610.0011
Template load0.00085.909210.0008
Template processing0.00021.652610.0002
Override
Cache load0.00064.221510.0006
General
dbfile0.00149.650080.0002
String conversion0.00000.056840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs