Author Topic: last commented image listing  (Read 88439 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
Re: paging
« Reply #30 on: February 27, 2003, 01:32:06 AM »
Quote from: mantra
What code to add if I want make paging after the limit comment is over.

if add paging feature, then this could go to MODs forum as a new MOD  :wink:
its not a very big deal to do, but there are so many little things needs to be done.
sry, dont have time to do so. (geee, cant belive I actualy said that! :? ) Maybe somebody else? ;)
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 mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
patient
« Reply #31 on: February 27, 2003, 01:37:37 AM »
Patient  :idea:

Offline Ernesto Taseffa

  • Full Member
  • ***
  • Posts: 151
    • View Profile
last commented image listing
« Reply #32 on: February 27, 2003, 11:46:13 AM »
.
« Last Edit: August 09, 2009, 01:29:48 AM by Ernesto Taseffa »

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 #33 on: February 27, 2003, 02:04:44 PM »
Quote from: seffern
V@no,

in your post from 14.2 on page 3, you wrote:

"after that, u can use in url: user_id=X where X is a user ID"

Could you explain that? I just do not know what you mean by this...

Thanks

Dirk

in my post on 12.03 I gave an example for it:
http://come.no-ip.com/example.php?user_id=22
as u can see, I just added user_id=22
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 O.K.

  • Pre-Newbie
  • Posts: 2
    • View Profile
last commented image listing
« Reply #34 on: March 04, 2003, 05:20:55 PM »
I got an idea. How about making the same thing as...
When someone adds an image, it says 'NEW' for a specified period. I want this feature for new comments. Is it possible?  :roll:

Offline vanner

  • Pre-Newbie
  • Posts: 4
    • View Profile
last commented image listing
« Reply #35 on: March 15, 2003, 11:04:35 PM »
Can someone show me how to replace the NEW images section of the index.php page, and replace it with the last 4 commented images.  I created my album here:

http://vanpham.com/4images/

As you notice, all the last commented images are posting on the bottom of the page...all the way to the bottom!!  I want to make the last 4 commented pictures to be horizontally set across the template under the categories secion (replacing the new images section that is normally there).

You can download the following files I tried to edit here:

http://vanpham.com/files/

I renamed index.php --> index.txt

============
Any help is apprecitated.  I am fairly new to php.

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
Problem if put in page header
« Reply #36 on: March 16, 2003, 05:59:10 PM »
I put this code in my page_header.php and it doesn't work right.  As soon as someone leaves a comment, all the category and image links only bring up that image or the category it is in.  As soon as I removed it from page_header.php everything worked fine again.

I move the code to top.php and index.php and it works fine there.  Must just be an issue with page_header.php.

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
Error
« Reply #37 on: April 22, 2003, 12:21:38 PM »
Hey great mod, but i get an error:

Code: [Select]
Fatal error: Call to undefined function: get_user_table_field() in /home/zippie/HTML/index.php on line 131

I running version 1.6 and that's almost the same. I think get_user_table_field must be something else. Maby you can help me? Because i like this mod very very much.

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: Error
« Reply #38 on: April 22, 2003, 12:42:31 PM »
Quote from: XippiX
Hey great mod, but i get an error:

Code: [Select]
Fatal error: Call to undefined function: get_user_table_field() in /home/zippie/HTML/index.php on line 131

I running version 1.6 and that's almost the same. I think get_user_table_field must be something else. Maby you can help me? Because i like this mod very very much.


*/me thinking why some people still on outdated software...:? *
just go throu the code and replace all get_user_table_field(", u.", "user_name") with:
, u.user_name

the " u. letter is just an example it might be any others or it might be just missing.
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 Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
last commented image listing
« Reply #39 on: April 22, 2003, 01:17:58 PM »
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$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 14";
  $result = $site_db->query($sql);
  $comment_row = array();
  while ($row = $site_db->fetch_array($result)) {
    $comment_row[] = $row;
  }


euh what do you mean?

Code: [Select]
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."


change in what? in this? , u.user_name
if yes, can you give an example? plz?  :oops:

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: Error
« Reply #40 on: April 24, 2003, 01:20:16 AM »
I already gave u an example:
Quote from: V@no

just go throu the code and replace all get_user_table_field(", u.", "user_name") with:
, u.user_name

the " u. letter is just an example it might be any others or it might be just missing.

in that example was user_name .
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 jackie911

  • Newbie
  • *
  • Posts: 41
    • View Profile
last commented image listing
« Reply #41 on: May 11, 2003, 09:47:09 AM »
After I add the following MOD to page_header.php, I chick to any pic on my site.  It will appear with same pics.  I'm not sure what the problems, please help me.

 :cry:
Jackie

my site ==> http://album.barndisco.com


Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$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 = 40;
      $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);

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 #42 on: May 11, 2003, 02:37:48 PM »
Quote from: jackie911
After I add the following MOD to page_header.php, I chick to any pic on my site.  It will appear with same pics.  I'm not sure what the problems, please help me.

sorry, I have no idea what are u talking about...and what is that code? whatever it is, it is wrong... :?
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 jackie911

  • Newbie
  • *
  • Posts: 41
    • View Profile
last commented image listing
« Reply #43 on: May 11, 2003, 04:10:51 PM »
Please try to access to my site and chick any pics for testing........Then you will get the problems.

This code was inserted to includes/page_header.php.

 :cry:

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 #44 on: May 11, 2003, 05:02:04 PM »
Quote from: jackie911
Please try to access to my site and chick any pics for testing........Then you will get the problems.

sorry, but I have to wait about 3-4 min untill your site opens for me...its very slow...

Quote from: jackie911
This code was inserted to includes/page_header.php.

is there any particulary reasons u inserted into page__header.php???? 8O
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)