ich habe mal das Thema chCounter abgetrennt, es passte nicht wirklich zum anderen Thema.
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_'
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_'
Code: Alles auswählen
//chCounter
define('CHC_DATA_TABLE', $table_prefix . 'chc_data');
Code: Alles auswählen
<!-- INCLUDE overall_footer.html -->
Code: Alles auswählen
<!-- INCLUDE chcounter_body.html -->
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>
Code: Alles auswählen
<?php
/**
*
* @author Original Author webmaster@selbsthilfeverband-inkontinenz.org
*
*
* @version $Id: chcounter.php,v 0.0.1 2008/03/11 Exp $
* @copyright (c) 2008 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'];
}
$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' => $visitor_pages_user_page,
'VISITOR_TIME_DAY' => $user->format_date($visitor_time_day),
'VISITOR_USER_DAY' => $visitor_user_day,
'VISITOR_PAGES_DAY' => $visitor_pages_day,
'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')
);
?>
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 pro Besucher pro Seite: ',
'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',
));
?>
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);
Code: Alles auswählen
include($phpbb_root_path . 'chcounter.' . $phpEx);
Wegen der Problematik mit den Umlauten in der chCounter Statistik bin ich nicht weiter gekommen. Ein Versuch, die Daten aus der Tabelle auszulesen zeigte, dass die Umlaute korrekt nach UTF-8 in der Tabelle abgespeichert sind, ich konnte sie ohne Probleme direkt richtig auslesen. Daher liegt das Problem wohl am chCounter selber.
Gruß Helmut