ZenphotoCMS Forum
print commentform AFTER a (while next_image) loop on image.php - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: print commentform AFTER a (while next_image) loop on image.php (/thread-8262.html)



print commentform AFTER a (while next_image) loop on image.php - mauritsivs - 2011-02-16

I have a (while next_image) loop on my image.php page to display all images in the album at once.
(the page is called with getFirstImageURL() )

after the while loop is done i place a commentform on this page. But i noticed that there is something going wrong with the printCommentForm()

the commentform ofcourse only posts a comment for the first image. the posting works ok, BUT the part of the function that displays the already posted comments shows "no comments". ( the context is set to another image by the while-loop??)

how do i set the context back to the first image before printing the commentform?

i could also use $_zp_current_image->getComments() and print the whole array separately but i would prefer the standard function inside the printcommentform() function since this is already fully styled.




print commentform AFTER a (while next_image) loop on image.php - acrylian - 2011-02-16

What are you actually doing or want to do? The next_image loop sets the current image object of course for each image in that loop one after another.

You can of course set the $_zp_current_image again to the object of the first image manually. See the object model tutorial.

If you want to show thumbs for navigation I suggest to use one of the plugins for this purpose: pagethumbsnav or jcarousel. That saves you all this hassle actually.




print commentform AFTER a (while next_image) loop on image.php - mauritsivs - 2011-02-16

in the end i want to display the posted comments separate from the form itself. right now i use part of the printCommentForm() function to display the comments:

`


">


on



`

if i place printCommentForm() BEFORE the while-loop everything is ok. but due to my design it has to be placed after it...and thus the function doesnt work correctly anymore.

i dont see how to make 'while (next_comment())' ,in the code above, loop through the first image comments in the tutorial you mention.




print commentform AFTER a (while next_image) loop on image.php - sbillard - 2011-02-16

You will have to preserve and then restore the context around the next_image() loop. It is not normal to have an "album" functionality on the image page, so to accomplish that you will have to remove the damage it has done.