Author Topic: Top- Fotos auf 20 erhöhen? / Top-images from 10 to 20 ???  (Read 5081 times)

0 Members and 1 Guest are viewing this topic.

Offline cas

  • Newbie
  • *
  • Posts: 15
    • View Profile
Top- Fotos auf 20 erhöhen? / Top-images from 10 to 20 ???
« on: April 14, 2003, 11:41:53 AM »
Hallo,
hat jemand eine Idee, wie man auf der Seite Top die Anzahl der Bilder mit den meisten Hits / Downloads auf 20 erhöhen kann?

Danke!

Gruss
Carsten

-------------------------------------------------
Hello,
how can I change the number of top-images with the most Hits / Downloads from 10 to 20 ?

Thanks
Carsten

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
Top- Fotos auf 20 erhöhen? / Top-images from 10 to 20 ???
« Reply #1 on: April 14, 2003, 11:54:48 AM »
in top.php find:
Code: [Select]
LIMIT 10and
Code: [Select]
for ($i = 1; $i <= 10; $i++) {
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 cas

  • Newbie
  • *
  • Posts: 15
    • View Profile
Top- Fotos auf 20 erhöhen? / Top-images from 10 to 20 ???
« Reply #2 on: April 14, 2003, 12:17:34 PM »
Hello,
thank you for your help!

But ist doesen't work, it shows me the same 10 images and not 20 images.

here ist my code:

Code: [Select]
// Hits
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
        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_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_hits DESC, i.image_name ASC
        LIMIT 20";
$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 <= 20; $i++) {
  if (isset($top_list[$i])) {
    $register_array['image_hits_'.$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'])."\">".htmlspecialchars($top_list[$i]['image_name'])."</a>" : htmlspecialchars($top_list[$i]['image_name']);
    $register_array['image_hits_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\">".htmlspecialchars($top_list[$i]['image_name'])."</a>" : htmlspecialchars($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_hits_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      $register_array['image_hits_user_'.$i] = $lang['userlevel_guest'];
    }
    $register_array['image_hits_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".htmlspecialchars($top_list[$i]['cat_name'])."</a>";
    $register_array['image_hits_number_'.$i] = "<b>".$top_list[$i]['image_hits']."</b>";
  }
  else {
    $register_array['image_hits_'.$i] = "--";
    $register_array['image_hits_user_'.$i] = "--";
    $register_array['image_hits_cat_'.$i] = "--";
    $register_array['image_hits_number_'.$i] = "--";
  }
}


Can i have more help?

Thanks
Carsten

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
Top- Fotos auf 20 erhöhen? / Top-images from 10 to 20 ???
« Reply #3 on: April 14, 2003, 12:23:17 PM »
ah, yes, that's right...:( u also will need edit /templates/<yourtemplate>/top.html and that's the...."pain" part...
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 cas

  • Newbie
  • *
  • Posts: 15
    • View Profile
Top- Fotos auf 20 erhöhen? / Top-images from 10 to 20 ???
« Reply #4 on: April 14, 2003, 01:25:32 PM »
Thanx !!!!
It works!!!!

Carsten

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Top- Fotos auf 20 erhöhen? / Top-images from 10 to 20 ???
« Reply #5 on: December 25, 2005, 10:36:35 PM »
A weakness has been discovered by using the $user_profile_link string.

From your top.php file,

find :

Quote

$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'];


replace with :

Code: [Select]

$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $top_list[$i]['user_id'], $url_show_profile) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id']);


Merry Christmas.