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.

 
irishblue

Joined: 2002-08-21
Posts: 19
Posted: Thu, 2003-01-23 14:08

does anyone know how i can do that?

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Thu, 2003-01-23 14:10

Do you want to have the button as text under the caption, or in the drop-down menu?

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Thu, 2003-01-23 18:33

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]}&amp;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")) &amp;&amp; ($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)

 
irishblue

Joined: 2002-08-21
Posts: 19
Posted: Fri, 2003-01-24 17:40

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

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Sat, 2003-01-25 01:11

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")) &amp;&amp; ($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]}&amp;index=$i";
$buf = "<span class=editlink>";
$buf .= '<a href="#" onClick="&amp;#039; . popup($url) . &amp;#039;">[add comment]</a>';
$buf .= "</span>";
echo "<br>$buf<br>";

</TD></TR></TABLE><!-- BBCode End -->

 
pbyjp
pbyjp's picture

Joined: 2002-11-12
Posts: 260
Posted: Tue, 2003-02-11 16:51

Hi Joan
In <!-- BBCode Start --><A HREF="http://gallery.menalto.com/modules.php?op=modload&amp;name=phpBB_14&amp;file=index&amp;action=viewtopic&amp;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

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Mon, 2003-03-10 15:00

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.

Quote:
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")) &amp;&amp; ($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]}&amp;index=$i";
$buf = "<span class=editlink>";
$buf .= '<a href="#" onClick="&amp;#039; . popup($url) . &amp;#039;">[add comment]</a>';
$buf .= "</span>";
echo "<br>$buf<br>";

</TD></TR></TABLE><!-- BBCode End -->