Author Topic: [MOD] Top 100  (Read 87742 times)

0 Members and 1 Guest are viewing this topic.

rinaldos

  • Guest
[MOD] Top 100
« on: October 16, 2008, 01:59:06 AM »
Code Update 12.11.2008 thanks to Nicky
http://www.4homepages.de/forum/index.php?topic=23055.msg127636#msg127636
---
Code Update 18.04.2009
In der Sektion Settings der TOP100.php können die Spalten aktiviert / deaktiviert werden. Die Thumbnailgrösse ist nun individuell einstellbar.
 
 Folgende Möglichkeiten sind nun gegeben.

  THUMBNAILGRÖSSE:
  $thumb_size = 48;

  Spalten die nun aktiviert bzw. deaktiviert werden können. 0 = deaktiviert 1 = aktiviert
  $top_100_pos_activate = "1"; // Picture Position
  $top_100_picture_activate = "1"; // Thumbnail
  $top_100_picture_id_activate = "0"; // Picture ID
  $top_100_picture_user_name_activate = "0"; // USER NAME
  $top_100_picture_user_name_below_activate = "0"; // Username below Thumbnail
  $top_100_picture_name_activate = "1"; // Picture Name
  $top_100_picture_cat_activate = "1";  // Cat Name
  $top_100_picture_date_activate = "1"; // Picture Date (Upload Date)
  $top_100_picture_hits_activate = "1";  // Picture Hits
  $top_100_picture_votes_activate = "1"; // Picture Votes
  $top_100_picture_rating_activate = "1";  // Picture ratings
  $top_100_picture_downloads_activate = "1";  // Picture downloads
  $top_100_picture_comment_activate = "1";  // Picture Comments
  $top_100_picture_last_view_activate = "1";  // Picture last view
  $top_100_picture_last_view_who_activate = "1";  // Picture seen by
---
Code Update 29.04.2009
Fixed a small error. New PHP file added. top100.php.1.3.1.zip
download and Overwrite the original top100.php
---

Dieser MOD ist dafür ausgelegt, eine dynamische Top 100 zu generieren.
Er zeigt folgende Daten an.

- top 100 Bilder mit den meisten HITS
- top 100 Bilder mit den meisten Stimmen
- top 100 Bilder mit den Bewertungen
- top 100 Bilder mit den meisten Kommentaren
- wer hat zuletzt welches Bild gesehen. Zwar kein Top 100 aber ich mag es

Weiterhin zeigt er auch nur Bilder an, die dem Kriterium entsprechen-
Habe ich nur 12 Bilder mit Bewertungen, dann zeigt er auch nur die zwölf Bilder an.
Bei der installation legt der installer das Datum des letzten views auf das Bilddatum.
Beachtet bitte das ich kein PHP Programmierer bin.

erstellt für die Version 1.7.6

Demo:
http://4images.rinaldos.homeip.net/top100.php?action=hits

Addon with highslide
http://rinaldos.homeip.net/top100.php?action=hits
benötigt dieses Addon
http://www.4homepages.de/forum/index.php?topic=20461.0

in der top100.php findet Ihr schon die passenden Einträge, müssen nur auskommentiert werden.

:flag-en:
This Mod prepares a dynamic TOP100 list. It will show the following data

- top 100 pictures with most hits
- top 100 pictures with most Votes
- the 100 pictures with most rating
- the 100 pictures with most comments
- the pictures which were looked at last. (However, it is no top 100, but i like it)

The mod is designed that if one of the criteria is not met 100 images, then it shows only the images that meet this criterion. As an example. I have  12 pictures with votes, then the mod also shows just the twelve images and no more.
During the installation, the installer set the date of the last view to the image date.
Please note that I'm not a PHP programmer.

works with Version 1.7.6

Demo:
http://4images.rinaldos.homeip.net/top100.php?action=hits

Addon with highslide
http://rinaldos.homeip.net/top100.php?action=hits
need this Addon
http://www.4homepages.de/forum/index.php?topic=20461.0

in the top100.php already find the matching entries, need only be commented.

:flag-de:
folgende Dateien sind neu
:flag-en:
following files are new

/top100_install.php (bitte nach dem ausführen löschen)
/top100.php
/templates/default/top100.html

:flag-de:
folgende Dateien müssen geändert werden
:flag-en:
following files must be changed

/details.php
/includes/page_header.php
/lang/deutsch/main.php
/lang/english/main.php
/templates/default/details.html
/templates/default/user_logininfo.html
/templates/default/user_loginform.html
/admin/checkimages.php
/member.php




1
:flag-de:
Logge dich als Admin ein und führe die Datei top100_install.php aus
:flag-en:
Just login as admin and run the file from top100_install.php

added 29.10.2008 via phpmyadmin
:flag-de:
oder via phpmyadmin
:flag-en:
or via phpmyadmin


ALTER TABLE 
`4images_imagesADD `image_last_viewINT11 NOT NULL DEFAULT '0';
ALTER TABLE `4images_imagesADD `image_last_view_whoVARCHAR255 NOT NULL DEFAULT 'Guest' AFTER `image_last_view`;
UPDATE `4images_imagesSET `image_last_view` = `image_dateWHERE `image_last_view` = 0;





2
 :flag-de:
lade die folgenden Dateien hoch
 :flag-en:
 upload the following files

top100.html -> /templates/default/top100.html
top100.php  -> /top100.php

3
:flag-de:
öffne details.php
suche
:flag-en:
open details.php
search
 

if ($user_info['user_level'] != ADMIN) {
  
$sql "UPDATE ".IMAGES_TABLE."
          SET image_hits = image_hits + 1
          WHERE image_id = 
$image_id";
  
$site_db->query($sql);
}


:flag-de:
dahinter einfügen
:flag-en:
insert below:


// ---------  MOD TOP 100   ----------
$user_name_who $user_info['user_name'];
   if (
$user_name_who == "") { 
      
$user_name_who Guest
   }
   else { 
        
$user_name_who $user_info['user_name']; 
   }
  
$sql "UPDATE ".IMAGES_TABLE."
          SET image_last_view = '"
.time()."', image_last_view_who = '$user_name_who'
          WHERE image_id = 
$image_id";
  
$site_db->query($sql);
// ---------  MOD TOP 100   ----------


:flag-de:
suche
:flag-en:
search


$sql 
"SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description,


:flag-de:
ersetze
:flag-en:
replace


$sql 
"SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_last_view, i.image_last_view_who,

corrected these line 04.07.2009
:flag-de:
suche
:flag-en:
search

$is_image_owner 
= ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 0;


:flag-de:
dahinter einfügen
:flag-en:
insert below:
 

// ---------  MOD TOP 100   ----------
$image_last_view_date format_date($config['date_format'],$image_row['image_last_view']);
$image_last_view_time format_date($config['time_format'],$image_row['image_last_view']);
$image_last_view_who $image_row['image_last_view_who'];
// ---------  MOD TOP 100   ----------


:flag-de:
suche
:flag-en:
search
 

"lang_next_image" => $lang['next_image'],

:flag-de:
dahinter einfügen
:flag-en:
insert below:


// ---------  MOD TOP 100   ----------
  
"lang_top100_picture_last_view_date" => $lang['top_100_picture_last_view_date'],
  
"lang_top100_picture_last_view_user" => $lang['top_100_picture_last_view_user'],
  
"image_last_view_date" => $image_last_view_date,
  
"image_last_view_time" => $image_last_view_time,
  
"image_last_view_who" => $image_last_view_who,
// ---------  MOD TOP 100   ----------



4
 :flag-de:
öffne includes/page_header.php
suche
 :flag-en:
 open includes/page_header.php
 search


"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),



:flag-de:
dahinter einfügen
:flag-en:
insert below:


// ---------  MOD TOP 100   ----------
"url_top100" => $site_sess->url(ROOT_PATH."top100.php?action=hits"),
// ---------  MOD TOP 100   ----------


 :flag-de:
 suche
 :flag-en:
 search
 

  
"charset" => $lang['charset'],


:flag-de:
dahinter einfügen
:flag-en:
insert below:


// ---------  MOD TOP 100   ---------- 
 
"lang_top100" => $lang['lang_top100'],
// ---------  MOD TOP 100   ----------


5
:flag-de:
öffne templates/default/user_logininfo.html
suche
:flag-en:
open templates/default/user_logininfo.html
search


&raquo; <a href="{url_logout}">{lang_logout}</a></td>



:flag-de:
ersetze
:flag-en:
replace


&raquo; <a href="{url_logout}">{lang_logout}</a><br />
&
raquo; <a href="{url_top100}">{lang_top100}</a></td>


6
:flag-de:
öffne templates/default/user_loginform.html
suche
:flag-en:
open templates/default/user_loginform.html
search


&raquo; <a href="{url_register}">{lang_register}</a></td>


 :flag-de:
ersetze
:flag-en:
replace


&raquo; <a href="{url_register}">{lang_register}</a><br />
&
raquo;<a href="{url_top100}">{lang_top100}</a></td>


7
:flag-de:
öffne lang/deutsch/main.php
suche
:flag-en:
open lang/deutsch/main.php
search


?>


:flag-de:
davor einfügen
:flag-en:
insert above:


// ---------  MOD TOP 100   ---------- 
$lang['lang_top100'] = "TOP 100";
$lang['lang_toplist_title_top100'] = " TOP 100";
$lang['lang_toplist_page'] = " Seite:";
$lang['no_top100'] = "Es sind noch keine Bilder mit dem Auswahlkriterium vorhanden";
$lang['top_100_picture'] = "Bild";
$lang['top_100_picture_name'] = "Name";
$lang['top_100_picture_id'] = "ID";
$lang['top_100_picture_cat'] = "Kat.";
$lang['top_100_picture_date'] = "Datum";
$lang['top_100_picture_hits'] = "Hits";
$lang['top_100_picture_votes'] = "Votes";
$lang['top_100_pos'] = "Pos.";
$lang['top_100_picture_rating'] = "Rating";
$lang['top_100_picture_last_view'] = "am";
$lang['top_100_picture_last_view_who'] = "von";
$lang['top_100_picture_last_view_date'] = "zuletzt gesehen am:";
$lang['top_100_picture_last_view_user'] = "zuletzt gesehen von:";
$lang['top_100_picture_downloads'] = "Downl.";
$lang['top_100_picture_comment'] = "Anm.";
$lang['top_100_url_votes'] = "Top100 Votes";
$lang['top_100_url_hits']  = "Top100 Treffer";
$lang['top_100_url_downloads']  = "Top100 Downloads";
$lang['top_100_url_comment']  = "Top100 Kommentare";
$lang['top_100_url_rating'] = "Top100 Rating";
$lang['top_100_url_view']  = "zuletzt angesehen";
$lang['top_100_url_rating'] = "Top100 Bewertung";
// ---------  MOD TOP 100   ----------


7
:flag-de:
öffne lang/english/main.php
suche
:flag-en:
open lang/english/main.php
search


?>


 :flag-de:
 davor einfügen
  :flag-en:
insert above:


// ---------  MOD TOP 100   ---------- 
$lang['lang_top100'] = "TOP 100";
$lang['lang_toplist_title_top100'] = " TOP 100 Pictures ";
$lang['lang_toplist_page'] = " Page:";
$lang['no_top100'] = "There are no pictures to show";
$lang['top_100_picture'] = "Picture";
$lang['top_100_picture_name'] = "Image Name";
$lang['top_100_picture_id'] = "ID";
$lang['top_100_picture_cat'] = "Category";
$lang['top_100_picture_date'] = "Date";
$lang['top_100_picture_hits'] = "Hits";
$lang['top_100_picture_votes'] = "Votes";
$lang['top_100_pos'] = "Pos.";
$lang['top_100_picture_rating'] = "Rating";
$lang['top_100_picture_last_view'] = "at";
$lang['top_100_picture_last_view_who'] = "seen by";
$lang['top_100_picture_last_view_date'] = "Last view:";
$lang['top_100_picture_last_view_user'] = "Last seen by:";
$lang['top_100_picture_downloads'] = "Downloads";
$lang['top_100_picture_comment'] = "Comments";
$lang['top_100_url_votes'] = "Top100 Votes";
$lang['top_100_url_hits']  = "Top100 Hits";
$lang['top_100_url_downloads']  = "Top100 Downloads";
$lang['top_100_url_comment']  = "Top100 Comments";
$lang['top_100_url_rating'] = "Top100 Rating";
$lang['top_100_url_view']  = "zuletzt angesehen";
$lang['top_100_url_rating'] = "Top100 Bewertung";
// ---------  MOD TOP 100   ----------


8
 :flag-de:
öffne templates/default/details.html
suche
 :flag-en:
 open templates/default/details.html
 search
 

<tr>
 <
td valign="top" class="row1"><b>{lang_date}</b></td>
 <
td valign="top" class="row1">{image_date}</td>
</
tr>



 :flag-de:
 dahinter einfügen
  :flag-en:
insert below


<tr class="row2">
 <
td valign="top" class="smalltext" width="295" ><b>{lang_top100_picture_last_view_date}</b></td>
 <
td valign="top" class="smalltext">{image_last_view_date} {image_last_view_time}</td>
</
tr>
<
tr class="row1">
 <
td valign="top" class="smalltext" width="295" ><b>{lang_top100_picture_last_view_user}</b></td>
 <
td valign="top" class="smalltext">{image_last_view_who}</td>
</
tr>


9
 :flag-de:
öffne admin/checkimages.php
suche
 :flag-en:
 open admin/checkimages.php
 search
 
(cat_iduser_idimage_nameimage_descriptionimage_keywordsimage_date,

:flag-de:
ersetze
:flag-en:
replace

(cat_iduser_idimage_nameimage_descriptionimage_keywordsimage_dateimage_last_view,

 :flag-de:
suche
 :flag-en:
 search

($cat_id$user_id'$image_name''$image_description''$image_keywords'$image_date,

:flag-de:
ersetze
:flag-en:
replace

($cat_id$user_id'$image_name''$image_description''$image_keywords'$image_date$image_date,

10
 :flag-de:
öffne /member.php
suche 2mal
 :flag-en:
 open /member.php
 search 2times
 
(cat_iduser_idimage_nameimage_descriptionimage_keywordsimage_date,


:flag-de:
ersetze
:flag-en:
replace

(cat_iduser_idimage_nameimage_descriptionimage_keywordsimage_dateimage_last_view,


 :flag-de:
suche 2mal
 :flag-en:
 search 2times

 ($cat_id".$user_info['user_id']."'$image_name''$image_description''$image_keywords'$current_time,


:flag-de:
ersetze
:flag-en:
replace

 ($cat_id".$user_info['user_id']."'$image_name''$image_description''$image_keywords'$current_time$current_time,



Gruß
Ingo
« Last Edit: April 21, 2010, 07:03:37 AM by rinaldos »

Offline kai

  • Administrator
  • Addicted member
  • *****
  • Posts: 1.421
    • View Profile
    • 4images - Image Gallery Management System
Re: [MOD] Top 100
« Reply #1 on: October 16, 2008, 08:03:21 AM »
Danke!

Evtl. kannst Du beim nächsten Mal den php-Code mit dem "php" BB-Code einklammern. Dann kommt die Syntax besser raus. :)
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [MOD] Top 100
« Reply #2 on: October 16, 2008, 08:46:42 AM »
Super Mod!!!!
Danke dafür!

@ kai,

kann ja keiner Ahnen das es einen neuen BBCODE gibt! Warum baut ihr denn kein Button dafür ein? bei SMF ist das doch einfach mit dem Package Manager! Oder ersetzt den Standard CODE mit PHP!

LG

rinaldos

  • Guest
Re: [MOD] Top 100
« Reply #3 on: October 16, 2008, 10:51:53 AM »
Codeupdate
Added Step9 and Step 10

Hatte ich heute morgen vergessen. Nun werden auch die Daten beim Upload eingefügt

Gruß
Ingo

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [MOD] Top 100
« Reply #4 on: October 16, 2008, 03:11:09 PM »
Hey, super!

Aber rinaldos, du solst anstatt "[code ] .... [/ code]" "[php ] .... [ /php]" nehmen ;)

Offline Carpfish

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Carp-Photo-Portal
Re: [MOD] Top 100
« Reply #5 on: October 29, 2008, 08:16:32 AM »
Habe alles Instaliert aber folgende Fehlermeldung bei der Datenbank


DB Error: Bad SQL Query: ALTER TABLE `4images_images` ADD `image_last_view` INT( 11 ) NOT NULL DEFAULT '0' AFTER `image_postcards`
Unbekanntes Tabellenfeld 'image_postcards' in 4images_images

DB Error: Bad SQL Query: ALTER TABLE `4images_images` ADD `image_last_view_who` VARCHAR( 255 ) NOT NULL DEFAULT 'Guest' AFTER `image_last_view`
Unbekanntes Tabellenfeld 'image_last_view' in 4images_images

DB Error: Bad SQL Query: UPDATE `4images_images` SET `image_last_view` = `image_date` WHERE `image_last_view` = 0
Unbekanntes Tabellenfeld 'image_last_view' in where clause

   1. Error
        ALTER TABLE `4images_images` ADD `image_last_view` INT( 11 ) NOT NULL DEFAULT '0' AFTER `image_postcards`

   2. Error
        ALTER TABLE `4images_images` ADD `image_last_view_who` VARCHAR( 255 ) NOT NULL DEFAULT 'Guest' AFTER `image_last_view`

   3. Error
        UPDATE `4images_images` SET `image_last_view` = `image_date` WHERE `image_last_view` = 0


Könnt ihr mir vieleicht weiterhelfen

Danke Andy

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Top 100
« Reply #6 on: October 29, 2008, 10:48:11 AM »
andy,
du musst die top100_install.php.zip  downloaden und top100_install.php auch ausführen damit die felder angelegt werden..
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Carpfish

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Carp-Photo-Portal
Re: [MOD] Top 100
« Reply #7 on: October 29, 2008, 05:16:36 PM »
@Nicky

Habe ich auch gemacht, aber beim Instalieren der top100_install.php kommt diese fehlermeldung im instalations Display.

Die Daten werden nicht auf die Datenbank geschrieben.

Wollte es manuell eintragen:

1: image_last_view` INT( 11 ) NOT NULL DEFAULT '0'                                                                            in den 4images_image Datenbank
2: image_last_view_who` VARCHAR( 255 ) NOT NULL DEFAULT 'Guest                                                     in den 4images_image Datenbank
3: UPDATE `4images_images` SET `image_last_view` = `image_date` WHERE `image_last_view` = 0        ????????? was sol ich da machen

Was soll ich bei Punkt 3 machen.
Ich hoffe es stimm die Daten in die 4images_image zu schreiben.

Gru0 Andy

rinaldos

  • Guest
Re: [MOD] Top 100
« Reply #8 on: October 29, 2008, 05:34:24 PM »
Wollte es manuell eintragen:
1: image_last_view` INT( 11 ) NOT NULL DEFAULT '0'                                                                            in den 4images_image Datenbank
2: image_last_view_who` VARCHAR( 255 ) NOT NULL DEFAULT 'Guest                                                     in den 4images_image Datenbank
3: UPDATE `4images_images` SET `image_last_view` = `image_date` WHERE `image_last_view` = 0        ????????? was sol ich da machen

Hallo,
also wenn du es manuell eintragen willst, dann mit phpmyadmin, 4images_images auswählen und die Einträge für image_last_view und image_last_view_who löschen (sofern vorhanden). Anschliessend  folgenden sql Befehle ausführen:


ALTER TABLE 
`4images_imagesADD `image_last_viewINT11 NOT NULL DEFAULT '0';
ALTER TABLE `4images_imagesADD `image_last_view_whoVARCHAR255 NOT NULL DEFAULT 'Guest' AFTER `image_last_view`;
UPDATE `4images_imagesSET `image_last_view` = `image_dateWHERE `image_last_view` = 0;


Damit sollte es klappen

Gruß
Ingo

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Top 100
« Reply #9 on: October 29, 2008, 05:39:57 PM »
yep rinaldos,

da es die
Code: [Select]
AFTER `image_postcards`nicht gibt ;)

hier die install
« Last Edit: October 29, 2008, 10:15:00 PM by Nicky »
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

rinaldos

  • Guest
Re: [MOD] Top 100
« Reply #10 on: October 29, 2008, 05:46:21 PM »
Hatte gerade den installer neu hochgeladen, und nur diese Zeile geändert

ALTER TABLE 
`4images_imagesADD `image_last_viewINT11 NOT NULL DEFAULT '0';

Damit die Tabelleneinträge am ende eingefügt werden, sowie den Schritt 3 in meinem posting geändert. Hatte ein [ /php ] vergessen, somit stand flag de im Code :-(

Gruß
Ingo

Offline Carpfish

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Carp-Photo-Portal
Re: [MOD] Top 100
« Reply #11 on: October 29, 2008, 07:33:25 PM »
 :lol: Thanks all

Funkt ohne Probleme.

Andy

rinaldos

  • Guest
Re: [MOD] Top 100
« Reply #12 on: October 29, 2008, 08:49:01 PM »
Das ist schön das nun alles klappt:-)

LG
Ingo

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Top 100
« Reply #13 on: October 30, 2008, 09:54:13 PM »
hey ho rinaldos,

ich schau mir gerade dein mod an..
eine ganz blöde frage, wozu braucht man bei einer top100 paging seiten?
ist das dann eine top100 oder topALL mit
$picture_per_page = 100;
$sort_order = 'DESC';
$max_picture = 100;      //for more pictures change this value
?
:mrgreen: :twisted:

sonnst.. toller mod!
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

rinaldos

  • Guest
Re: [MOD] Top 100
« Reply #14 on: October 31, 2008, 06:04:39 AM »
Hi,
ich hatte erst nur 25 Bilder angezeigt ($picture_per_page = 25;). Also wurden dann 4 Seiten daraus.
Da ich es aber nicht hinbekommen habe, das dann auf Seite 1 die Nummerierung (Spalte 1 Pos.) 1-25, Seite 2 (Spalte 1 Pos.)26-50 usw ist, habe ich das paging noch drin gelassen, für den Fall das ich noch eine Lösung finde. Ergo habe ich den MOD mit ($picture_per_page = 100;) veröffentlicht.

Du hast recht, so wie er gerade veröffentlicht ist, brauch man kein Paging............

LG
Ingo