add comment on thumbnail page
irishblue
Joined: 2002-08-21
Posts: 19 |
Posted: Tue, 2003-01-21 15:43 |
how do i insert the add comment link in the thumbnail view also? instead of having any user click on the thumbnail then seeing it. |
|
Posts: 19
does anyone know how i can do that?
Posts: 3474
Do you want to have the button as text under the caption, or in the drop-down menu?
Posts: 3473
Just edit view_album.php, and add the following
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
if (!$gallery->album->isAlbumName($i))
{
$id=$gallery->album->getPhotoId($i);
$url = "add_comment.php?set_albumName={$gallery->album->fields[name]}&id=$id";
$buf = "<span class=editlink>";
$buf .= '<a href="#" onClick="' . popup($url) . '">[add comment]</a>';
$buf .= "</span>";
echo "<br>$buf";
}
</TD></TR></TABLE><!-- BBCode End -->
after
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
if (!(strcmp($gallery->album->fields["display_clicks"] , "yes")) && ($gallery->album->getItemClicks($i) > 0)) {
echo("Viewed: ".pluralize($gallery->album->getItemClicks($i), "time", "0").".<br>");
</TD></TR></TABLE><!-- BBCode End -->
(you'll have to test this)
Posts: 19
hi there. thanks for replying. I tried the code you gave me. The link only turned up for the first photo in the album and displayed this error when clicking on the link:
ERROR: requested index [] out of bounds [6]
Fatal error: Call to a member function on a non-object in /home/virtual/site51/fst/var/www/html/gallery/classes/Album.php on line 681
Posts: 3473
I said you'd have to test it :smile:
OK, I've set up a test gallery, and this seems to work (yes, the other one was broken).
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
echo("<br>");
if (!(strcmp($gallery->album->fields["display_clicks"] , "yes")) && ($gallery->album->getItemClicks($i) > 0)) {
echo("Viewed: ".pluralize($gallery->album->getItemClicks($i), "time", "0").".<br>");
}
$url = "add_comment.php?set_albumName={$gallery->album->fields[name]}&index=$i";
$buf = "<span class=editlink>";
$buf .= '<a href="#" onClick="&#039; . popup($url) . &#039;">[add comment]</a>';
$buf .= "</span>";
echo "<br>$buf<br>";
</TD></TR></TABLE><!-- BBCode End -->
Posts: 260
Hi Joan
In <!-- BBCode Start --><A HREF="http://gallery.menalto.com/modules.php?op=modload&name=phpBB_14&file=index&action=viewtopic&topic=3817" TARGET="_blank">this thread</A><!-- BBCode End --> I am trying to do smth similar by putting the [add comment] link in the search results...
So far I have troubles setting the $i properly.
Would you help?
cheers
p
Posts: 185
Hmm, I had added this function a while and thought I'd do it again today and I realized that this never actually worked for me unless I did what was done for the view_photo.php for hte popup. Not sure why, but your code produced popup($url) literally, so I just incorporated the view_photo.php page where it worked.
I replaced the line with popup in your code with this:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
$buf .= "<a href="#" onClick="javascript:nw=window.open('$url',
'Edit','height=500,width=500,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes');nw
.opener=self;return false; }">[add comment]</a>";
</TD></TR></TABLE><!-- BBCode End -->
And it works fine for me now. But thanks for pointing out where and what to put.