4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Enforcer on July 10, 2010, 09:14:58 PM

Title: newest 10 comments
Post by: Enforcer on July 10, 2010, 09:14:58 PM
is it possible to show the newest 10 commtents?
Title: Re: newest 10 comments
Post by: V@no on July 10, 2010, 09:26:51 PM
yes.

If such answer is not good enough, please review MUST READ- Guidelines (forum rules) for posting questions in this forum! (http://www.4homepages.de/forum/index.php?topic=3914.0)
Your post has no sufficient information for a "good" answer ;)
Title: Re: newest 10 comments
Post by: Enforcer on July 10, 2010, 10:08:20 PM
i'm sorry my english isn't very good.

i tried to show the latest 10 comments as a seperate table at the "top images" page,
bu i failed. i'm not very familiar with the 4images code.
could anybody show me how it would work?
Title: Re: newest 10 comments
Post by: V@no on July 10, 2010, 10:50:57 PM
There you go, much better ;)

But how do you think it should be displayed? Do you want to see list of images that received new comments, or comments headlines?

Or even perhaps you'd be interested in [MOD] Last comments v1.2.0 (http://www.4homepages.de/forum/index.php?topic=15701.msg35837#msg35837)?
Title: Re: newest 10 comments
Post by: Enforcer on July 12, 2010, 09:48:29 PM
this mod is very good,
but is it possible to show the newest 10 comments at "top images"?

the mod only works at "home"...

thanks for your help
Title: Re: newest 10 comments
Post by: Rembrandt on July 14, 2010, 09:11:53 AM
..
but is it possible to show the newest 10 comments at "top images"?..

search in top.php
// Hits
insert above:
//##################################  Comments Start ######################################################

$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_comments, i.image_hits, c.cat_name,d.comment_date".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c, ".COMMENTS_TABLE." d)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = d.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND i.image_id = d.image_id AND d.user_name = u.user_name
        $cat_match_sql
        GROUP BY i.image_id
        ORDER BY d.comment_date DESC
        LIMIT 10";
$result = $site_db->query($sql);
$top_list = array();
$i = 1;
while ($row = $site_db->fetch_array($result)) {
  $top_list[$i] = $row;
  $i++;
}
$site_db->free_result();

for ($i = 1; $i <= 10; $i++) {
  if (isset($top_list[$i])) {
$register_array['image_comment_'.$i] = (in_array($top_list[$i]['cat_id'], explode(",", $cat_id_sql)) != $top_list[$i]['cat_id']) ? "<a href=".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id']).">" .format_text($top_list[$i]['image_name'], 2)."</a>" : format_text($top_list[$i]['image_name'], 2);

    $register_array['image_comment_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
    $register_array['image_comment_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
    if (isset($top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      $user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      $register_array['image_comment_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      $register_array['image_comment_user_'.$i] = $lang['userlevel_guest'];
    }
    $register_array['image_comment_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
    $register_array['comment_date_'.$i] = date("d-m-Y H:i",$top_list[$i]['comment_date']);
  }
  else {
    $register_array['image_comment_'.$i] = "--";
    $register_array['image_comment_user_'.$i] = "--";
    $register_array['image_comment_cat_'.$i] = "--";
    $register_array['comment_date_'.$i] = "--";
  }
}
//##################################  comment End ######################################################

search in top.php
"clickstream" => $clickstream,
insert below:
"lang_top_image_comment" => $lang['top_image_comment'],

serach in lang/english/main.php
$lang['top_image_votes'] = "Top 10 images by votes";
insert below:

$lang['top_image_comment'] = " Top 10 Images by Newest Comments";


serach in templates /yourTemplates  top.html:
Code: [Select]
<td valign="top" class="row2" nowrap>{image_downloads_number_10}</td>
                          </tr>
insert below:
Code: [Select]
<tr>
                            <td class="head1" valign="top" colspan="5">{lang_top_image_comment}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row1" align="center"><b>1</b></td>
                            <td valign="top" class="row1">{image_comment_1}</td>
                            <td valign="top" class="row1">{image_comment_user_1}</td>
                            <td valign="top" class="row1">{image_comment_cat_1}</td>
                            <td valign="top" class="row1" nowrap>{comment_date_1}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row2" align="center"><b>2</b></td>
                            <td valign="top" class="row2">{image_comment_2}</td>
                            <td valign="top" class="row2">{image_comment_user_2}</td>
                            <td valign="top" class="row2">{image_comment_cat_2}</td>
                            <td valign="top" class="row2" nowrap>{comment_date_2}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row1" align="center"><b>3</b></td>
                            <td valign="top" class="row1">{image_comment_3}</td>
                            <td valign="top" class="row1">{image_comment_user_3}</td>
                            <td valign="top" class="row1">{image_comment_cat_3}</td>
                            <td valign="top" class="row1" nowrap>{comment_date_3}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row2" align="center"><b>4</b></td>
                            <td valign="top" class="row2">{image_comment_4}</td>
                            <td valign="top" class="row2">{image_comment_user_4}</td>
                            <td valign="top" class="row2">{image_comment_cat_4}</td>
                            <td valign="top" class="row2" nowrap>{comment_date_4}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row1" align="center"><b>5</b></td>
                            <td valign="top" class="row1">{image_comment_5}</td>
                            <td valign="top" class="row1">{image_comment_user_5}</td>
                            <td valign="top" class="row1">{image_comment_cat_5}</td>
                            <td valign="top" class="row1" nowrap>{comment_date_5}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row2" align="center"><b>6</b></td>
                            <td valign="top" class="row2">{image_comment_6}</td>
                            <td valign="top" class="row2">{image_comment_user_6}</td>
                            <td valign="top" class="row2">{image_comment_cat_6}</td>
                            <td valign="top" class="row2" nowrap>{comment_date_6}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row1" align="center"><b>7</b></td>
                            <td valign="top" class="row1">{image_comment_7}</td>
                            <td valign="top" class="row1">{image_comment_user_7}</td>
                            <td valign="top" class="row1">{image_comment_cat_7}</td>
                            <td valign="top" class="row1" nowrap>{comment_date_7}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row2" align="center"><b>8</b></td>
                            <td valign="top" class="row2">{image_comment_8}</td>
                            <td valign="top" class="row2">{image_comment_user_8}</td>
                            <td valign="top" class="row2">{image_comment_cat_8}</td>
                            <td valign="top" class="row2" nowrap>{comment_date_8}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row1" align="center"><b>9</b></td>
                            <td valign="top" class="row1">{image_comment_9}</td>
                            <td valign="top" class="row1">{image_comment_user_9}</td>
                            <td valign="top" class="row1">{image_comment_cat_9}</td>
                            <td valign="top" class="row1" nowrap>{comment_date_9}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="row2" align="center"><b>10</b></td>
                            <td valign="top" class="row2">{image_comment_10}</td>
                            <td valign="top" class="row2">{image_comment_user_10}</td>
                            <td valign="top" class="row2">{image_comment_cat_10}</td>
                            <td valign="top" class="row2" nowrap>{comment_date_10}</td>
                          </tr>

I hope this is what you want.

mfg Andi
Title: Re: newest 10 comments
Post by: Enforcer on August 15, 2010, 08:43:40 AM
yes, it works! thanks a lot for the solution!
Title: Re: newest 10 comments
Post by: Enforcer on August 23, 2010, 01:52:58 PM
oh noes, it only shows the comments that were the newest at the moment i installed the modification.
any solution?
Title: Re: newest 10 comments
Post by: Rembrandt on August 23, 2010, 02:26:52 PM
...
any solution?

i hope  8O

search in the code:
GROUP BY i.image_id
and replace:
GROUP BY d.comment_date DESC

mfg Andi