which $item with printLatestComment function for current image

Hi,
Sorry for the noob question, but I have no dev skills...
I am customizing zenji theme, and try to display latest comment for the current image in the side bar, so within image.php file (I expect comments for that image only, same as with the printComment Form() does).

I've seen the printLatestComments() function, and the $item parameter ("the record id of element to get the comments for") required when using 'image' as $type for that function.
But I cannot find what is needed as $item value in my case.

I tried the following :
<?php printLatestComments(3,50,'image',$_zp_current_image); ?>
But then nothing is returned. When using :
<?php printLatestComments(3,50,'all'); ?>
I can get latests comments from the gallery, so the function works.

Any help woud lbe welcome !
Thank you.

Comments

  • acrylian Administrator, Developer

    You nearly got it. The id refers to the id of item in the database, you get this via $_zp_current_image->getID().

    But if you use comments, the comments would be listed below the comment form anyway so you would double them, wouldn't you?

  • pled Member

    Thanks, it works !

    Yes, latest comments would be duplicated... unless I use the printCommontForm function, setting the $displaycomments to false :

    <?php printCommentForm(false); ?>

    Then only the "add a comment" section is displayed at the bottom. Perfect !

    Ideally, I would like to display all comments in the sidebar (there are generally few comments for a specific image in my gallery, so it should size here well) ; but I guess the printCommentForm allows to only display comments ? This is why I am using printLastestComments in the side bar, and using a bigger $number should do the trick !

  • pled Member

    Sorry I meant printCommentForm() does not allow to display only comments (ie the add new comment section is included).

  • acrylian Administrator, Developer

    printCommentForm() does not make much sense if you disable the form, does it. But you already found how to disable the comments listing.

    There are numerous way to display comments instead of using printLatestComments(). You could use the object model directly (the base level if you will with full control over the output). Or you can use the next_comment loop on an image page (or any other item type like an album, Zenpage page or article) to show all of its comments. You can see it's usage within printCommentForm() around line 340.

  • pled Member

    Right, the next_comment loop is more appropriate for my purpose, and probably easier to use for me compared to object model ! I will use it.
    Thank you for your kind help.

Sign In or Register to comment.