Seite 1 von 2
Problem beim phpbb coding
Verfasst: 18.04.2006 01:08
von psprofi
Hi
Ich hab ein problem.
Ich habe mir eine 404 Page gemacht mit text der in english und in deutsch vorhanden ist.
Aber bisher zeigt er immer nur die sprache an die als standart im Board eingestellt ist.
Wie kann ich das machen das immer die sprache angezeigt wird die der benutzer eingestelllt hat und wenn er gast ist die Standartsprache angezeigt wird??
Danke im vorraus
Verfasst: 18.04.2006 01:26
von fanrpg
$userdata['user_lang'] dort steht die Sprache des Users drinne.
Verfasst: 18.04.2006 01:40
von psprofi
und wie binde ich das ein?
Sry aber bin ein noob in sache coding
Verfasst: 18.04.2006 08:02
von StarWolf3000
so könnte der Code lauten:
Code: Alles auswählen
<?
//Benötigte Dateien und Variablen von phpBB
define('IN_PHPBB', true);
$phpbb_root_path = './'; // !Diese Variable zum Forenpfad anpassen!
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//Session auslesen und Benutzer-Informationen laden
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// Sprache lesen
$user_lang = ( $userdata['user_lang'] ) ? $userdata['user_lang'] : $board_config['default_lang'];
// Seiteninhalt
if($user_lang == "german")
{
// Code für deutsch
}
if($user_lang == "english")
{
// Code für englisch
}
?>
Verfasst: 18.04.2006 18:16
von psprofi
achso aber was für ein code muss bei deutsch und bei englisch hin??
Verfasst: 18.04.2006 18:20
von Ivan
Dein Text

Verfasst: 18.04.2006 19:45
von psprofi
dies ist meine datei:
Code: Alles auswählen
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_errorcode.' . $phpEx);
$userdata = session_pagestart($user_ip, PAGE_TEMPLATE);
init_userprefs($userdata);
$page_title = $lang['page_title'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => '404.tpl')
);
include($phpbb_root_path . 'includes/404.'.$phpEx);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Verfasst: 18.04.2006 20:24
von Dave
Code: Alles auswählen
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'language/lang_' . $userdata['user_lang'] . '/lang_errorcode.' . $phpEx);
$userdata = session_pagestart($user_ip, PAGE_TEMPLATE);
init_userprefs($userdata);
$page_title = $lang['page_title'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => '404.tpl')
);
include($phpbb_root_path . 'includes/404.'.$phpEx);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
So isses besser

Verfasst: 18.04.2006 20:56
von psprofi
da kommt dann nur ne weiße seite
Verfasst: 19.04.2006 20:57
von Dave
Code: Alles auswählen
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_TEMPLATE);
init_userprefs($userdata);
include($phpbb_root_path . 'language/lang_' . $userdata['user_lang'] . '/lang_errorcode.' . $phpEx);
$page_title = $lang['page_title'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => '404.tpl')
);
include($phpbb_root_path . 'includes/404.'.$phpEx);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>