Hallo,
Da ich meinen Eingangspost nicht mehr bearbeiten kann, habe ich ihn noch einmal hierher kopiert und mit einigen Änderungen versehen !
Ich habe inzwischen eine Lösung für das Problem mit den Sprachvariablen gefunden, welche aber etwas Aufwendiger ist. Dazu gehe ich her und hole mir die Daten direkt aus der Datenbank und erzeuge selber die Anzeige, damit bin ich völlig Unabhängig vom chCounter. Um das zu bewerkstelligen sind einige Dateien zu erstellen und den Präfix der Tabellen vom chCounter zu ändern. Hier nun die Anleitung:
1. Den Präfix der Tabellen vom chCounter in der Datenbank ändern von
chc_* nach
phpbb3_chc_* (mit phpmyadmin). Dabei stellt phpbb3_ den Präfix des Forums dar. Dieser kann auch abweichend sein (z.B. phpbb_ , irgendwas_ , .....), das ist von den Angaben des Users bei der Installation des Forums abhängig.
2. Öffne die Datei
config.inc.php im Verzeichnis
includes/ vom chCounter und ersetze:
Code: Alles auswählen
// Prefix of the chCounter database tables:
// Präfix der chCounter Datenbanktabellen:
// Préfixe des tableaux de la base de données du chCounter:
'tables_prefix' => 'chc_'
mit folgendem Inhalt:
Code: Alles auswählen
// Prefix of the chCounter database tables:
// Präfix der chCounter Datenbanktabellen:
// Préfixe des tableaux de la base de données du chCounter:
'tables_prefix' => 'phpbb3_chc_'
3. In die
constands.php folgendes am Ende vor
?> eintragen:
Code: Alles auswählen
//chCounter
define('CHC_DATA_TABLE', $table_prefix . 'chc_data');
4. Öffne die
prosilver/templates/index_body.html und finde:
Füge davor ein:
5. Erstelle eine Datei im Verzeichnis
prosilver/templates/ mit dem Namen
chcounter_body.html und füge folgendes ein:
Code: Alles auswählen
<h3>{L_COUNTER2}</h3>
<p>
{L_VISITOR_ALL} <strong>{VISITOR_ALL}</strong> {COUNTER_START}<br />
{L_VISITOR_TODAY}<strong>{VISITOR_TODAY}</strong> {L_VISITOR_TODAY_TIME}<strong>{VISITOR_TODAY_TIME}</strong> •
{L_VISITOR_YESTERDAY}<strong>{VISITOR_YESTERDAY}</strong> •
{L_VISITOR_MAX_ONLINE}<strong>{VISITOR_MAX_ONLINE}</strong> {L_VISITOR_MAX_ONLINE_TIME}<strong>{VISITOR_MAX_ONLINE_TIME}</strong> •
{L_VISITOR_MAX_PER_DAY}<strong>{VISITOR_MAX_PER_DAY}</strong> {L_VISITOR_MAX_PER_DAY_TIME}<strong>{VISITOR_MAX_PER_DAY_TIME}</strong> •
{L_VISITOR_PAGES_ALL}<strong>{VISITOR_PAGES_ALL}</strong> •
{L_VISITOR_PAGES_TODAY}<strong>{VISITOR_PAGES_TODAY}</strong> •
{L_VISITOR_PAGES_YESTERDAY}<strong>{VISITOR_PAGES_YESTERDAY}</strong> •
{L_VISITOR_PAGES_USER}<strong>{VISITOR_PAGES_USER}</strong> •
{L_VISITOR_PAGES_USER_PAGE}<strong>{VISITOR_PAGES_USER_PAGE}</strong> •
{L_VISITOR_TIME_DAY}<strong>{VISITOR_TIME_DAY}</strong> •
{L_VISITOR_USER_DAY}<strong>{VISITOR_USER_DAY}</strong> •
{L_VISITOR_PAGES_DAY}<strong>{VISITOR_PAGES_DAY}</strong> •
{L_VISITOR_MAX_PAGES_DAY}<strong>{VISITOR_MAX_PAGES_DAY}</strong> {L_VISITOR_MAX_PAGES_DAY_TIME}<strong>{VISITOR_MAX_PAGES_DAY_TIME}</strong>
</p>
6. Erstelle eine Datei im Verzeichnis
/ mit dem Namen
chcounter.php und füge folgendes ein:
Code: Alles auswählen
<?php
/**
*
* @author Original Author webmaster@selbsthilfeverband-inkontinenz.org
*
*
* @version $Id: chcounter.php,v 0.0.2 2010/05/01 Exp $
* @copyright (c) 2010 Helmut Schreiber
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
die('Hacking Attempt!');
}
define('IN_PHPBB', true); // we tell the page that it's going to be using phpBB, this is important.
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
// Language file (see documentation related to language files)
$user->setup('ch_counter');
//Select data from database
$sql = "SELECT *
FROM ". CHC_DATA_TABLE .'
ORDER BY besucher_gesamt ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$visitor_all = $row['besucher_gesamt'];
$visitor_today = $row['besucher_heute'];
$visitor_today_time = $row['heute_timestamp'];
$visitor_yesterday = $row['besucher_gestern'];
$visitor_max_online = $row['max_online:anzahl'];
$visitor_max_online_time = $row['max_online:timestamp'];
$visitor_max_per_day = $row['max_besucher_pro_tag:anzahl'];
$visitor_max_per_day_time = $row['max_besucher_pro_tag:timestamp'];
$visitor_pages_all = $row['seitenaufrufe_gesamt'];
$visitor_pages_today = $row['seitenaufrufe_heute'];
$visitor_pages_yesterday = $row['seitenaufrufe_gestern'];
$visitor_pages_user = $row['seitenaufrufe_pro_besucher:besucher'];
$visitor_pages_user_page = $row['seitenaufrufe_pro_besucher:seitenaufrufe'];
$visitor_time_day = $row['durchschnittlich_pro_tag:timestamp'];
$visitor_user_day = $row['durchschnittlich_pro_tag:besucher'];
$visitor_pages_day = $row['durchschnittlich_pro_tag:seitenaufrufe'];
$visitor_max_pages_day = $row['max_seitenaufrufe_pro_tag:anzahl'];
$visitor_max_pages_day_time = $row['max_seitenaufrufe_pro_tag:timestamp'];
$counter_durchschnitt = (time() - gmmktime(0, 0, 0, gmdate('n', $visitor_time_day), gmdate('j', $visitor_time_day), gmdate('y', $visitor_time_day))) / 86400;
}
$template->assign_vars(array(
'VISITOR_ALL' => $visitor_all,
'VISITOR_TODAY' => $visitor_today,
'VISITOR_TODAY_TIME' => $user->format_date($visitor_today_time),
'VISITOR_YESTERDAY' => $visitor_yesterday,
'VISITOR_MAX_ONLINE' => $visitor_max_online,
'VISITOR_MAX_ONLINE_TIME' => $user->format_date($visitor_max_online_time),
'VISITOR_MAX_PER_DAY' => $visitor_max_per_day,
'VISITOR_MAX_PER_DAY_TIME' => $user->format_date($visitor_max_per_day_time),
'VISITOR_PAGES_ALL' => $visitor_pages_all,
'VISITOR_PAGES_TODAY' => $visitor_pages_today,
'VISITOR_PAGES_YESTERDAY' => $visitor_pages_yesterday,
'VISITOR_PAGES_USER' => $visitor_pages_user,
'VISITOR_PAGES_USER_PAGE' => number_format(@round($visitor_pages_user_page / $counter_durchschnitt, 2), 2),
'VISITOR_TIME_DAY' => $user->format_date($visitor_time_day),
'VISITOR_USER_DAY' => number_format(@round($visitor_user_day / $counter_durchschnitt, 2), 2),
'VISITOR_PAGES_DAY' => number_format(@round($visitor_pages_day / $counter_durchschnitt, 2), 2),
'VISITOR_MAX_PAGES_DAY' => $visitor_max_pages_day,
'VISITOR_MAX_PAGES_DAY_TIME' => $user->format_date($visitor_max_pages_day_time),
'COUNTER_START' => sprintf($user->lang['COUNTER_START'], $user->format_date($config['board_startdate'], false, true)),
));
$db->sql_freeresult($result);
$template->set_filenames(array(
'body' => 'chcounter_body.html')
);
?>
7. Erstelle eine Datei im Verzeichnis
language/de/ mit dem Namen
ch_counter.php und füge folgendes ein:
Code: Alles auswählen
<?php
/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
//chCounter
$lang = array_merge($lang, array(
'VISITOR_ALL' => 'Besucher gesamt',
'VISITOR_TODAY' => 'Besucher heute: ',
'VISITOR_TODAY_TIME' => 'am ',
'VISITOR_YESTERDAY' => 'Besucher gestern: ',
'VISITOR_MAX_ONLINE' => 'Besucher gesamt gleichzeitig Online: ',
'VISITOR_MAX_ONLINE_TIME' => 'am ',
'VISITOR_MAX_PER_DAY' => 'Besucher gleichzeitig Online pro Tag: ',
'VISITOR_MAX_PER_DAY_TIME' => 'am ',
'VISITOR_PAGES_ALL' => 'Seitenaufrufe gesamt: ',
'VISITOR_PAGES_TODAY' => 'Seitenaufrufe heute: ',
'VISITOR_PAGES_YESTERDAY' => 'Seitenaufrufe gestern: ',
'VISITOR_PAGES_USER' => 'Seitenaufrufe pro Besucher: ',
'VISITOR_PAGES_USER_PAGE' => 'Seitenaufrufe gesamt: ',
'VISITOR_TIME_DAY' => 'am ',
'VISITOR_USER_DAY' => 'Durchschnittlich Besucher pro Tag: ',
'VISITOR_PAGES_DAY' => 'Durchschnittlich Seitenaufrufe pro Tag: ',
'VISITOR_MAX_PAGES_DAY' => 'Max. Seitenaufrufe pro Tag: ',
'VISITOR_MAX_PAGES_DAY_TIME' => 'am ',
'COUNTER_START' => 'seit dem %s',
'COUNTER2' => 'Besucherstatistik',
));
?>
Achtung! Diese Datei unter UTF-8
ohne BOM abspeichern!
8. Öffne die Datei
index.php aus dem Root Verzeichnis und finde darin
Code: Alles auswählen
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
Füge darunter ein
Damit sollte die einfache Besucherstatistik unterhalb den normalen Statistik zu sehen sein. Was alles Angezeigt wird, das kann nun frei bestimmt werden, auch das Style lässt sich nun ohne Probleme anpassen. 4seven, du kannst ja nochmal prüfen ob ich keinen Fehler bei den Sprachvariablen drinnen habe und der Text dazu passt.
@nemesisx69x
Ich habe den Fehler gefunden, in der Tabelle _chc_data in der Spalte "seitenaufrufe_gesamt" und der Spalte "durchschnittlich_pro_tag:seitenaufrufe" der gleiche Wert eingetragen wird. Ich habe mir das im chCounter angeschaut, da wird der Durchschnittswert aus den timestamp der Spalte "durchschnittlich_pro_tag:timestamp" erst kurz vor der Ausgabe berechnet.
Mir ist das noch gar nicht aufgefallen dass das nicht passt, da meine neue Homepage noch nicht online ist und sich bis jetzt auch keiner zu diesem Fehler gemeldet hatte. Ich habe oben die Änderungen eingebaut, du musst nur noch die chcounter.php mit dem neuen Code versehen. In der Sprachdatei war übrigens auch noch ein kleiner Fehler drinnen. Damit sollte es jetzt aber bei dir gehen.
Gruß Helmut