4images Modifications / Modifikationen > Mods & Plugins (Releases & Support)

[MOD] Top 100

(1/15) > >>

rinaldos:
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_images` ADD `image_last_view` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `4images_images` ADD `image_last_view_who` VARCHAR( 255 ) NOT NULL DEFAULT 'Guest' AFTER `image_last_view`;
UPDATE `4images_images` SET `image_last_view` = `image_date` WHERE `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']) ? 1 : 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_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_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_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_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

kai:
Danke!

Evtl. kannst Du beim nächsten Mal den php-Code mit dem "php" BB-Code einklammern. Dann kommt die Syntax besser raus. :)

Sunny C.:
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:
Codeupdate
Added Step9 and Step 10

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

Gruß
Ingo

Sunny C.:
Hey, super!

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

Navigation

[0] Message Index

[#] Next page

Go to full version