Member
Member
pled   2021-11-01, 11:44
#1

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 :

But then nothing is returned. When using :

I can get latests comments from the gallery, so the function works.

Any help woud lbe welcome !
Thank you.

Administrator
Administrator
acrylian   2021-11-01, 12:22
#2

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?

Member
Member
pled   2021-11-01, 13:45
#3

Thanks, it works !

Yes, latest comments would be duplicated... unless I use the printCommontForm function, setting the $displaycomments to 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 !

Member
Member
pled   2021-11-01, 16:44
#4

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

Administrator
Administrator
acrylian   2021-11-01, 18:57
#5

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.

Member
Member
pled   2021-11-13, 18:24
#6

Right, the [code]next_comment[/code] 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.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.