Author Topic: last commented image listing  (Read 88692 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
last commented image listing
« Reply #60 on: May 27, 2003, 02:17:48 PM »
Quote from: Bomba
is this what u asked?  :roll:
lol... were u talking to me?  :oops:

yes ;)
well, I've gotta try it myself, then I might find out how it works...but for now, here is my example.php file:
http://come.no-ip.com/example.phps
maybe u can figure something out ;)

@Art1977:
I'm not sure what could be wrong, can I see it in action?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
last commented image listing
« Reply #61 on: May 27, 2003, 02:26:06 PM »
thanks mate! :D

i've seen your code and that's the code of index.php right?
i inserted the code in page_header because i don't want to show last comments in home.html, i want to have new template just for that
i created comments.html where i'd put {comments_short}

but this example of yours its different, it uses a new php file? how can i create this example.php? just copying index.php code?
maybe it would work, dunno

it's so sad to be a newbie :(  
:wink:

Offline Art1977

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.d-mack.de
hi
« Reply #62 on: May 27, 2003, 02:39:28 PM »
i created a new php file last_comments.php

i copied the code of index.php in this file.
an modified it thats all

then i added in the user box a new link "letzte kommentare"
this links opens the last_comments.php file , that was all
but i have some problems with the layout and with the paging
the code ...

also the code has a lot of lines which are not needed

Offline Art1977

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.d-mack.de
thx v@no
« Reply #63 on: May 28, 2003, 02:57:42 AM »
@vano

under
http://mitglied.lycos.de/brkcrew/4images1.7/4images/last_comments.php

u will see what i mean

now i would the last comments displayed like the categories ........


but if i copy the part of the code from categories and change it
i always get 9 times the same comment
what u see is the backup before i changed the code ......
the ftp is down at the moment so i can´t upload the file
maybe u have an idea how i could display the comments like the thumbs on the categories site ....

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
last commented image listing
« Reply #64 on: June 04, 2003, 06:00:04 PM »
well everything is now working perfectly, with paging and everything :)
i just would like to have bellow the thumbnail the {user_name} that owns the pic, but if i insert the same tag as in details.html it shows allways the same username, and its always the user that has the #id of the # comments per page.

how can i add user_image tag in this mod?
thanks

Offline helluvaguy

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
last commented image listing
« Reply #65 on: June 06, 2003, 04:19:16 PM »
Quote from: V@no
...but for now, here is my example.php file:
http://come.no-ip.com/example.phps

I'm using your file but all text is displayed bold. I tried to find where you set that but couldn't find it. Could you help me?

Offline kaisuny

  • Pre-Newbie
  • Posts: 6
    • View Profile
last commented image listing
« Reply #66 on: June 16, 2003, 12:34:51 PM »
It's a great mod. Follow your instruction, I could list some comments info. on he left side under  detail.php mode..

But how can I make them displaying in a horizontal order instead of a verticle one.. I prefer  them to be displaed in the center under the big random photo. Would  it be possible to enlighten me, please?


Thanks

Offline rene

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: thx v@no
« Reply #67 on: April 13, 2005, 10:54:07 PM »
maybe u have an idea how i could display the comments like the thumbs on the categories site ....

insert {comment_image_thumb} in your comment_short_bit.html --> template

Offline Art1977

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.d-mack.de
Re: last commented image listing
« Reply #68 on: April 14, 2005, 03:21:08 PM »
Thx i already included everything.

Offline msummo

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: last commented image listing
« Reply #69 on: April 15, 2005, 07:11:47 PM »
is paging now working? i want this feature but i can't get it working by myself

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: last commented image listing
« Reply #70 on: April 24, 2005, 10:04:10 AM »
So... again me :)
A little question.
I made a modification to my member_profile.html template, I had inserted this into a table:
Code: [Select]
<a href="last.php?user_id={user_id}">20 last comments</a>
Looks that everything must work, it works but not with every member.
If member have no comments a link didn`t work try: http://www.pramoga.net/member.php?action=showprofile&user_id=2359
When I click "20 paskutiniu komentaru" link redirects to: http://www.pramoga.net/member.php&user_id=2359

How to solve this?
Again this addres?!
http://www.funny.lt

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: last commented image listing
« Reply #71 on: April 24, 2005, 10:39:51 AM »
Uch one more problem, I think big, and why problems are always with me?  :?

Whent I add this:
Code: [Select]
$additional_sql = "";
     $table_fields = $site_db->get_table_fields(USERS_TABLE);
     foreach ($additional_user_fields as $key => $val) {
       if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
         $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
       }
     }
 if (isset($HTTP_GET_VARS['user_id']) and $HTTP_GET_VARS['user_id'] != ""){
$add_where = "WHERE c.user_id IN (".$user_id.")";
 }else{
$add_where = "";
 }
 $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
         FROM ".COMMENTS_TABLE." c
         LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
".$add_where."
         ORDER BY c.comment_date DESC
       LIMIT 14";
 $result = $site_db->query($sql);
 $comment_row = array();
 while ($row = $site_db->fetch_array($result)) {
   $comment_row[] = $row;
 }
 $site_db->free_result($result);
 $num_comments = sizeof($comment_row);
 if (!$num_comments) {
   $comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
 }
 else {
   $comments_short = "";
   for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
       if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
         $comment_user_info = $lang['userlevel_user'];
       }
       elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
         $comment_user_info = $lang['userlevel_admin'];
       }
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
  if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
       $thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
     }else {
       $thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
     }
     $thumb_info = @getimagesize($thumb_file);
     $width = $thumb_info[0];
     $height = $thumb_info[1];
     $dimension = 100;
     $ratio = $width / $height;
     if ($ratio > 1) {
       $new_width = $dimension;
       $new_height = floor(($dimension/$width) * $height);
     }else {
       $new_width = floor(($dimension/$height) * $width);
       $new_height = $dimension;
     }
     $site_template->register_vars(array(
      "comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&amp;mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
         "comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
   } // end while
 } //end else
 $site_template->register_vars("comments_short", $comments_short);
 unset($comments_short);

To my page_header.php
All links of images goes to last commented image. How can it be?
I had to comment this code and everything works now...
Again this addres?!
http://www.funny.lt

Offline fotograf74

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: last commented image listing
« Reply #72 on: June 03, 2005, 02:33:51 PM »
Is it possible to integrate the last Comments in a other page outside from 4images, like a phpbb Forum?

Offline Smart

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: last commented image listing
« Reply #73 on: June 11, 2005, 03:03:26 PM »
Hallo

Da mein englisch leiter grotten schlecht ist verstehe ich hier fast nix deswegen schreibe ich auf deutsch und würde mich sehr über eine deutsche antwort freuen :)

habe folgendes problem habe den comment Mod mit thumbnails eingebaut nach kleines problemen am anfang ging es danach super einfach :) ich habe jetzt nur folgendes problem sobald ich ein kommentar abgebe werde ich jedes mal zu dem Bild wo ich das kommentar abgegeben habe geleitet auch wenn ich auf andere bilder klicke werde immer zu dem einen geschikt.

währe cool wenn mir hier einer helfen könnte.

MFG

Offline mag

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: last commented image listing
« Reply #74 on: June 14, 2005, 08:48:57 AM »
P.S. links to image details/category/user profile should be automaticaly disabled if u not authorized to view that page.

how can i change it to see it for all?

i have installed the mod with 4i 1.7.1 and with thumbs, but i see only the gif pic ? ca anyone help me