hallo,
ich habe alles so gemacht wie es hier beschrieben ist (glaub ich), die statistiken isnd aber nicht zu sehen.
woran kann das liegen
www.netzpfosten.deThe idea is to show more statistics then the number of images and categories (which are shown by default).
This MOD will show:
- Number of Members
- Number of Image Votes
- Number of Image Hits
- Number of Image Comments
- Number of Image Downloads
All these are shown on totals, so it shows the total number of image hits over all images. You can see an example of it here:
http://haunter.student.utwente.nl/Terrarevolution/galleries/index.php// Ok, now lets get startedCreating the stats.php fileMake a new file called: stats.php
Save this empty file in the includes folder of 4images
Open stats.php with any code editor you like.
and copy past the following to your stats.php:
<?PHP
//-----------------------------------------------------
//--- Show number of Users ----------------------------
//-----------------------------------------------------
$sql = "SELECT COUNT(*) as users
FROM ".USERS_TABLE."
WHERE user_id <> ".GUEST;
$row = $site_db->query_firstrow($sql);
$total_users = "".$lang['users']."<B> ".$row['users']."</B>\n";
$site_template->register_vars("total_users", $total_users);
unset($total_users);
//-----------------------------------------------------
//--- Hits --------------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_hits) AS sum
FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0;
$total_hits = "".$lang['total_hits']."<B> ".$row['sum']."</B>\n";
$site_template->register_vars("total_hits", $total_hits);
unset($total_hits);
//-----------------------------------------------------
//--- Votes -------------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_votes) AS sum
FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0;
$total_votes = "".$lang['total_votes']."<B> ".$row['sum']."</B>\n";
$site_template->register_vars("total_votes", $total_votes);
unset($total_votes);
//-----------------------------------------------------
//--- Downloads ---------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_downloads) AS sum
FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0;
$total_downloads = "".$lang['total_downloads']."<B> ".$row['sum']."</B>\n";
$site_template->register_vars("total_downloads", $total_downloads);
unset($total_downloads);
//-----------------------------------------------------
//--- Comments ----------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_comments) AS sum
FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$sum = (isset($row['sum'])) ? $row['sum'] : 0;
$total_comments = "".$lang['total_comments']."<B> ".$row['sum']."</B>\n";
$site_template->register_vars("total_comments", $total_comments);
unset($total_comments);
?>
Now save the stats.php file.
ALWAYS BACKUP: any file you start editing as you might not be able to restore it when the mod doesn't workAdding the statistics to the language files:*NOTE* I only edited this in English, but you will have to copy this to any language you use and maybe translate the english.Open the main.php file from the lang/[your language] folder of 4images.
Go all the way to the bottom of the file.
Find:
//-----------------------------------------------------
//--- Admin Links -------------------------------------
//-----------------------------------------------------
$lang['edit'] = "[Edit]";
$lang['delete'] = "[Delete]";
Add Before:
//-----------------------------------------------------
//--- Statistics --------------------------------------
//-----------------------------------------------------
$lang['users'] = "Total Members:";
$lang['total_hits'] = "Total Image Hits:";
$lang['total_votes'] = "Total Image Votes:";
$lang['total_downloads'] = "Total Image Downloads:";
$lang['total_comments'] = "Total Image Comments:";
Including the statistics in Index.php:Open index.php in the root folder of 4images with any code editor you like.
Find:
require(ROOT_PATH.'includes/sessions.php');
Add after:
include(ROOT_PATH.'includes/stats.php');
Do the same for catergories.php, lightbox.php, top.php
(it might also work in memberlist.php, search.php, register.php etc. but I did not test them yet)
Now edit the template files that correspond with the php files you added the include to.
index.php = home.html
categories.php = categories.html
lightbox.php = lightbox.html
top.php = top.html
you can find the templates inside the templates/default folder of 4images.
In the templates you can now use the following tags:
{total_users} - This will show the total number of members
{total_votes} - This will show the total number of image votes
{total_comments} - This will show the total number of image comments
{total_hits} - This will show the total number of image hits
{total_downloads} - This will show the total number of image downloads
Uploading all the edited files:Now upload all files you editted to the right folder at your webserver.
This is a list of files you need to upload:
./index.php
./categories.php
./lightbox.php
./top.php
./includes/stats.php
./lang/ (any language you editted) /main.php
./templates/ (any templates you editted) /home.html
./templates/ (any templates you editted) /categories.html
./templates/ (any templates you editted) /lightbox.html
./templates/ (any templates you editted) /top.html
of course if you editted any more files then the once I mentioned above, you will need to upload them too.
I think this is it. Please note that it could be that I made an error somewhere in the directions above. As soon as you notice any error, please let me know and I will correct it as soon as possible.
Enjoy this little mod!!!