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

0 Members and 1 Guest are viewing this topic.

Offline jackie911

  • Newbie
  • *
  • Posts: 41
    • View Profile
last commented image listing
« Reply #45 on: May 11, 2003, 05:10:49 PM »
Nothing........

Quote

is there any particulary reasons u inserted into page__header.php???? 8O

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 #46 on: May 11, 2003, 05:17:06 PM »
sorry, didnt mean to be rude ;)
but, this should be inserted into page_header.php only if u want show your last comments on all/any pages, otherwise, u should use it only in the files u want it to be showed.
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 #47 on: May 18, 2003, 09:29:48 PM »
Can i insert this in index.php and then show in a new template?
i would call it using this for ex.
Code: [Select]
index.php?template=comments

and how can i make paging of this? my site has many comments and i would like to have a limit of 20 per page, for example, and have paging below it.
also i would like to know how can i insert this pagin in this mod
http://4homepages.de/forum/viewtopic.php?t=4131


thanks

Offline LoOpP

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
last commented image listing
« Reply #48 on: May 19, 2003, 02:14:17 PM »
is it possible to make that users can choose how many last commted images they want to see??

thx for help

tobi

Offline LoOpP

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
last commented image listing
« Reply #49 on: May 20, 2003, 08:52:03 AM »
no idea?

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
last commented image listing
« Reply #50 on: May 20, 2003, 03:33:49 PM »
i added code to my index.php and finished the "comment_short_bit.html" and then i add the
Code: [Select]
{comments_short} in a new template called comments.html

now when i go to "index.php?template=comments" nothing shows

should i insert the code in page_header?
if so, where should it be?

thanks

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
last commented image listing
« Reply #51 on: May 24, 2003, 02:12:14 AM »
i add the code in page_header.php and it shows last commented pics, but when i click in any thumb, it goes always to same picture, and this happen in all files (index.php, categories.php, ...)

here's the page_header.php code:
Code: [Select]
//--- End Photo Of The Day ----------------------------

$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]))."'";
        }
      }
  $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)
          ORDER BY c.comment_date DESC
          LIMIT 30";
  $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 = 120;
      $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);
//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------


any ideia what could possible be wrong?
thanks

Offline Art1977

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.d-mack.de
Comments on a new template with paging
« Reply #52 on: May 26, 2003, 06:39:10 PM »
I have greatet a new link in user box called last comments .

This opens a new template which shows the last comments .....
But the paging function doesent work and i want the comments like V@no
in a table form like the thumbnail gallery ......

here is my code in the php file :

<?php
$templates_used = 'whos_online,comment_short_bit,last_comments,commentsperpage_dropdown_form';
$main_template = 'last_comments';

define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
if (isset($HTTP_GET_VARS['template']) || isset($HTTP_POST_VARS['template'])) {
  $template = (isset($HTTP_GET_VARS['template'])) ? stripslashes(trim($HTTP_GET_VARS['template'])) : stripslashes(trim($HTTP_POST_VARS['template']));
  if (!file_exists(TEMPLATE_PATH."/".$template.".".$site_template->template_extension)) {
    $template = "";
  }
  else {
    $main_template = $template;
  }
}
else {
  $template = "";
}
include(ROOT_PATH.'includes/page_header.php');


//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].get_category_path($cat_id)."</span>";



//-----------------------------------------------------
//--- Letzte Kommentare
//-----------------------------------------------------
 
if (isset($HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage'])) {
  $commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']);
  if ($commentsetperpage) {
    $site_sess->set_session_var("commentperpage", $commentsetperpage);
    $session_info['commentperpage'] = $commentsetperpage;
  }
}

if (isset($session_info['commentperpage'])) {
  $commentperpage = $session_info['commentperpage'];
}
else {
  $commentperpage = 5;
}
$commentsperpage_dropdown = "\n<select name=\"commentsetperpage\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['commentsperpage'].submit() }\" class=\"select\">\n";
    for($i = 1; $i <= 15; $i++) {
      $setvalue = 1 * $i;
      $commentsperpage_dropdown .= "<option value=\"".$setvalue."\"";
        if ($setvalue == $commentperpage) {
        $commentsperpage_dropdown .= " selected=\"selected\"";
      }
      $commentsperpage_dropdown .= ">";
      $commentsperpage_dropdown .= $setvalue;
      $commentsperpage_dropdown .= "</option>\n";
    }
    $commentsperpage_dropdown .= "</select>\n";

    $site_template->register_vars("commentsperpage_dropdown", $commentsperpage_dropdown);
    $commentsperpage_dropdown_form = $site_template->parse_template("commentsperpage_dropdown_form");
    $site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);
      $sql = "SELECT COUNT(image_id) AS comments
      FROM ".COMMENTS_TABLE."
      WHERE image_id = $image_id";
    $result = $site_db->query_firstrow($sql);
    $site_db->free_result();
    $num_comments = $result['comments'];
    if ($action == "postcomment") {
        $page = ceil($num_comments / $commentperpage);
    }
    $num_rows_all = (isset($num_comments)) ? $num_comments : 0;
    $link_arg = $site_sess->url(ROOT_PATH."details.php?image_id=$image_id");
    include(ROOT_PATH.'includes/paging.php');
    $getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
    $offset = $getpaging->get_offset();
    $site_template->register_vars(array(
      "paging" => $getpaging->get_paging(),
      "paging_stats" => ($num_comments) ? $getpaging->get_paging_stats() : ""
    ));            

$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]))."'";
        }
      }
  $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)
          ORDER BY c.comment_date DESC
          LIMIT $offset, $commentperpage";
  $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 = 80;
      $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);

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>

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
Re: Comments on a new template with paging
« Reply #53 on: May 26, 2003, 07:54:13 PM »
Quote from: Art1977
But the paging function doesent work

please be more specific what exacly doesnt work? do u get error messages or it just doesnt show?
did u add in your template {paging} tag?
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 Art1977

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.d-mack.de
Yes
« Reply #54 on: May 26, 2003, 09:36:15 PM »
I hope this would explain my problem ....

http://www.4homepages.de/forum/viewtopic.php?p=25407#25407

there are my files last_comments.php and last_comments.html

i wanted to fit your code you posted in this thread to my needs.

you can also look on my page under http://www.dmack.de.vu under party-pics ....if u register and press the "letzte kommentare" in the user box u will see the last comments but u canīt chose how much comments u want to see..... and i want those comments in a table like the thumbnails in a gallery...

thx for our fast answer

Art

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
last commented image listing
« Reply #55 on: May 27, 2003, 01:30:36 PM »
im sorry for insist
but i really need this mod :( i have more than 1000 comments made and about 90 per day ...

this would be the solution or, another way to do it would be shown last comments made to images in their owner profiles...
none of this is possible?

i've posted my problem 3 posts above. thanks in advance

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 #56 on: May 27, 2003, 01:41:38 PM »
what tag do u se to open a picture? ( {...} )
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 Art1977

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.d-mack.de
The only problem is the paging is not shown in my template
« Reply #57 on: May 27, 2003, 01:55:21 PM »
The only problem is the paging is not shown in my template

I open the page wiht the link "letzte kommentare" in the user box .

There the last comments are shown .....
If i change the number of comments on the details site......
this affects the number of comments on my "last_comments" site
but i could not change the number directly on my template site ,because the dropdown menu is not shown on my new template ......

do u have an idea why ? my code is posted here :

http://www.4homepages.de/forum/viewtopic.php?p=25407#25407

Offline Bomba

  • Full Member
  • ***
  • Posts: 202
    • View Profile
last commented image listing
« Reply #58 on: May 27, 2003, 01:57:13 PM »
in that new template that this mod tells to creat "coment_short_bit.html"
i use

{comment_image_name}
{comment_cat_name}

and
{comment_image_thumb}


is this what u asked?  :roll:
lol... were u talking to me?  :oops:

Offline Art1977

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.d-mack.de
sorry
« Reply #59 on: May 27, 2003, 02:02:46 PM »
i would ask v@no

but itīs ok ! LOL