Author Topic: how to add a seperate top_votes.php?  (Read 12115 times)

0 Members and 1 Guest are viewing this topic.

Offline gifwav

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.funpics4u.com
how to add a seperate top_votes.php?
« on: April 12, 2005, 12:38:48 PM »
Hi,

I want to create seperate top30's voor votes, downloads etc. (like http://www.terradreams.de/gallery/).
I've copied top.php and top.html and named them for example "topvotes.php" and "topvotes.html".
I changed the code for votes:

Code: [Select]
// Votes
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name".get_user_table_field(", u.", "user_name").", i.image_thumb_file, i.image_media_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_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_votes DESC, i.image_name ASC
        LIMIT 30";
$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 <= 30; $i++) {
if (isset($top_list[$i])) {
           if (empty($top_list[$i]['image_thumb_file'])) {
                  $thumb_file = ICON_PATH."/".get_file_extension($top_list[$i]['image_media_file']).".gif";
         }else {
                   $thumb_file = (is_remote($top_list[$i]['image_thumb_file'])) ? $top_list[$i]['image_thumb_file'] : THUMB_PATH."/".$top_list[$i]['cat_id']."/".$top_list[$i]['image_thumb_file'];
         }
}

  if (isset($top_list[$i])) {
    $register_array['image_votes_'.$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'])."\">".multilang(htmlspecialchars($top_list[$i]['image_name']))."</a>" : htmlspecialchars(multilang($top_list[$i]['image_name']));
    $register_array['image_votes_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\">".multilang(htmlspecialchars($top_list[$i]['image_name']))."</a>" : htmlspecialchars(multilang($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_votes_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      $register_array['image_votes_user_'.$i] = $lang['userlevel_guest'];
    }
    $register_array['image_votes_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".multilang(htmlspecialchars($top_list[$i]['cat_name']))."</a>";
   if ($top_list[$i]['image_votes'] == "1") {$votes=$lang['vote'];}
    else {$votes=$lang['votes'];}
    $register_array['image_votes_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$votes.")";
  $register_array['image_votes_thumb_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\"><img src=\"".$thumb_file."\"  border=\"1\" alt=\"\" />";
}
  else {
    $register_array['image_votes_'.$i] = "--";
    $register_array['image_votes_user_'.$i] = "--";
    $register_array['image_votes_cat_'.$i] = "--";
    $register_array['image_votes_number_'.$i] = "--";
$register_array['image_votes_thumb_'.$i] = "--";
  }
}


I've enlarged the topvotes.html with:

Code: [Select]
<td valign="top" class="row2" align="center" width="20%">
<br />{image_votes_thumb_11}
<br />{image_votes_11}
<br />{image_votes_cat_11}
<br />{image_votes_number_11}</td>

etc.

But nothing changed in the browser.
What are the following steps?

regards,

Jan

www.funpics.4u.com

Offline gifwav

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.funpics4u.com
Re: how to add a seperate top_votes.php?
« Reply #1 on: April 14, 2005, 06:07:52 PM »
Hello,

I've got the solution!
Just change in topvotes.php:

Code: [Select]
$main_template = 'top';
into:

Code: [Select]
$main_template = 'topvotes';

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: how to add a seperate top_votes.php?
« Reply #2 on: December 25, 2005, 10:08:34 PM »
From your topvotes.php file,

change :

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


to :

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.

Offline Biggi

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://www.bibodia.de/
Re: how to add a seperate top_votes.php?
« Reply #3 on: August 20, 2007, 12:27:28 PM »
I had the same idea and I did everything exactly as it was explained in this thread. My new files are called "favorites.php" and "favorites.html.
But I don't get any output on my page as you can see here in action:  :wink:  http://www.bildmomente.de/gallery/index.php?template=favorites

Any ideas about what to do next?

-------------------------------------------------

In german:
ich hatte die gleiche Idee wie hier beschrieben und möchte die Statistiken zu den gevoteten Bildern auf eine externe Seite bringen. Ich habe
dazu die top.php und die top.html kopiert, die hier im Thread genannten Änderungen durchgeführt und habe die Dateien in "favorites.php" und "favorites.html" umbenannt. Ich bekomme aber kein Output in meine Tabelle.



Hat jemand Ideen für mich? Was ist noch zu tun?

Danke!

Viele Grüße, Biggi
 

manurom

  • Guest
Re: how to add a seperate top_votes.php?
« Reply #4 on: August 20, 2007, 01:04:25 PM »
Hello;
the link should rather be: http://www.bildmomente.de/gallery/favorites.php

But it shows this error:
Quote
Fatal error: Call to undefined function: multilang() in /homepages/43/d31566465/htdocs/www.bildmomente.de/gallery/favorites.php on line 124

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: how to add a seperate top_votes.php?
« Reply #5 on: August 20, 2007, 01:57:55 PM »
If use Multi-Language MOD, error message clear. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Biggi

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://www.bibodia.de/
Re: how to add a seperate top_votes.php?
« Reply #6 on: August 20, 2007, 05:29:32 PM »
I don't use a multilanguage-mod...  :?
This line seems to come from the code I copied from above.

Now I used the original code of top.php and changed the name to "favorites.php". But nothing happens. What do I have do do to get the statistics of the votes from top-list to a new file? Can you help?

Thanks in advance!

Biggi

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: how to add a seperate top_votes.php?
« Reply #7 on: August 20, 2007, 05:32:18 PM »
Quote
I don't use a multilanguage-mod...  :?
This line seems to come from the code I copied from above.

If is so no use, why see multilang for error if take from above and above no multilang command in ? :?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: how to add a seperate top_votes.php?
« Reply #8 on: August 20, 2007, 06:02:03 PM »
Same time - patch for all:

this line:

Quote
$register_array['image_votes_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($top_list[$i][$user_table_fields['user_name']])."</a>";
    }

should say:

Quote
$register_array['image_votes_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text(stripslashes($top_list[$i][$user_table_fields['user_name']]), 2)."</a>";
    }
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Biggi

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://www.bibodia.de/
Re: how to add a seperate top_votes.php?
« Reply #9 on: August 20, 2007, 06:11:14 PM »
I think I have problems to understand what you want to say...

Do you mean, I should again copy the code from the beginning of this thread to my top.php, rename it to "favorites.php" and change the line you posted at last and this is the solution of my problem?

Could you explain in a few more words, please? I really don't know what to do now, maybe a language-problem...

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: how to add a seperate top_votes.php?
« Reply #10 on: August 20, 2007, 06:16:15 PM »
Quote
Fatal error: Call to undefined function: multilang() in /homepages/43/d31566465/htdocs/www.bildmomente.de/gallery/favorites.php on line 124

Ok so please post from line 124 to line 130 from your favorites.php file.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Biggi

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://www.bibodia.de/
Re: how to add a seperate top_votes.php?
« Reply #11 on: August 20, 2007, 06:19:04 PM »
Sometime things make me wonder...

I just clicked on the link that manurom posted, with "favorites.php" at the end. And after I changed back to the original code of top.php and renamed it to favorites.php there are suddenly entries in my table...
It begins to work...  :)

Now I only have to find out, why the thumb in front of a line is not displayed.

Offline Biggi

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • http://www.bibodia.de/
Re: how to add a seperate top_votes.php?
« Reply #12 on: August 20, 2007, 07:03:00 PM »
Solved...

Thank YOU and manurom for the hint to link it as "favorites.php". I probably would have never found out...  :D
It works pretty fine now...

Thanks!

Biggi