$site_template->register_vars(array(
"media_url" => MEDIA_PATH,
"thumb_url" => THUMB_PATH,
Add before:$query_string = '';
if (!empty($HTTP_GET_VARS)) {
foreach ($HTTP_GET_VARS as $key => $val) {
if ($key != "l") {
$query_string .= ($query_string != '' ? '&' : '?').$key."=".$val;
}
}
}
// We add the session id with "&" not "&"
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');
// Now we can better remove the "l" parameter
$lang_url = preg_replace("/[?|&]l=[^?|&]*/", "", $lang_url);
// We replace "&" with "&" to make it valid XHTML
$lang_url = str_replace("&", "&", $lang_url);
$lang_select = "<form action=\"".$lang_url."\" method=\"post\">\n";
$lang_select .= "<select class=\"select\" name=\"l\" onChange=\"submit()\">\n";
// Now we open the "lang" folder, read out all available languages
// and add it as options to the dropdown.
$handle = opendir(ROOT_PATH."lang");
while ($folder = @readdir($handle)) {
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
$lang_select .= "<option value=\"".$folder."\"";
// If the folder name matches the current language,
// show the option as selected
if ($folder == $config['language_dir']) {
$lang_select .= " selected=\"selected\"";
}
$lang_select .= ">".$folder."</option>\n";
}
}
$lang_select .= "</select>\n</form>";
// Register the dropdown code for the template engine
$site_template->register_vars("lang_select", $lang_select);
$site_template->register_vars(array(
"media_url" => MEDIA_PATH,
"thumb_url" => THUMB_PATH,
Add before:$query_string = '';
if (!empty($HTTP_GET_VARS)) {
foreach ($HTTP_GET_VARS as $key => $val) {
if ($key != "l") {
$query_string .= ($query_string != '' ? '&' : '?').$key."=".$val;
}
}
}
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');
$lang_url = preg_replace("'&(amp|#38);'i", "&", $lang_url);
$lang_url = preg_replace("/[?|&]l=[^?|&]*/", "", $lang_url);
$lang_url = str_replace("&", "&", $lang_url);
$handle = opendir(ROOT_PATH."lang");
$lang_select = "";
while ($folder = @readdir($handle)) {
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
if ($folder != $config['language_dir']) {
$lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/english/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a> ";
}else{
$lang_select .= "<img src=\"".TEMPLATE_PATH."/images/".$folder."2.gif\" border=\"0\" alt=\"".$folder."\"> ";
}
}
}
// Register the dropdown code for the template engine
$site_template->register_vars("lang_select", $lang_select);
preg_match("/english/i"
to whatever is your default languageI think I know what's the problem ;)
if u said, that your default language is not english, then u'll also need change:Code: [Select]preg_match("/english/i"
to whatever is your default language
hope that's what it is
where to change this code? Or where to put it?
------- Note ------------------------
Version B is set to use images (I use it on my site)
the filenames of images must be this format:
language_folder_name.gif - for not currently selected languages
and
language_folder_name2.gif - for currently selected language
_________________[
what about the third language image link? Which one is for the third language image link?
------- Note ------------------------
Version B is set to use images (I use it on my site)
the filenames of images must be this format:
language_folder_name.gif - for not currently selected languages
and
language_folder_name2.gif - for currently selected language
can you tell me the size for the gif file, 80*60 is good? :):lol: hehe whatever your eyes would enjoy :wink:
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
$lang_eng = "";
if ($config['language_dir'] != $config['language_dir_default']) {
include(ROOT_PATH.'lang/'.$config['language_dir_default'].'/main.php');
$lang_eng = $lang;
}
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
if ($lang_eng) {
foreach ($lang_eng as $key => $val) {
$lang[$key] = ($lang[$key]) ? $lang[$key] : $lang_eng[$key];
}
}
Open /includes/global.php
QuoteOpen /includes/global.php
I think global.php in root directory V@no.
who wants to help me ? :cry:
<a href="
<?php
global $site_sess;
echo $site_sess->url(ROOT_PATH."index.php?template=help");
?>
">Help</a>
One more question: May I somehow save the lang-setting for the visitor - so he gets the same language when visiting the page next time (well, unless he doesn't delete his cookies) I guess I saw such a topic here on the forum, but can't re-find thatits possible, try this:
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
$l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
if (file_exists(ROOT_PATH.'lang/'.$l.'/main.php')) {
$config['language_dir'] = $l;
}
}
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
$requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
if ($requested_l != $config['language_dir'] && file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
$l = $requested_l;
$config['language_dir'] = $l;
}
}
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
$requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
if (!preg_match('#\.\.[\\\/]#', $requested_l) && file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php'))
{
if ($requested_l != $config['language_dir'])
{
$l = $requested_l;
}
$config['language_dir'] = $requested_l;
setcookie('4images_lang', $requested_l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
}
}
else
{
if (isset($HTTP_COOKIE_VARS['4images_lang']) && !preg_match('#\.\.[\\\/]#', $HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.trim($HTTP_COOKIE_VARS['4images_lang']).'/main.php'))
{
$l = $config['language_dir'] = trim($HTTP_COOKIE_VARS['4images_lang']);
}
}
define("LANG_URL", !(isset($HTTP_COOKIE_VARS['4images_lang']) && trim($HTTP_COOKIE_VARS['4images_lang']) == $config['language_dir']));
$lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/english/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a> ";
with this: $lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a> ";
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
$l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
if (file_exists(ROOT_PATH.'lang/'.$l.'/main.php')) {
$config['language_dir'] = $l;
setcookie('4images_lang', $l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
}
}
else
{
if (isset($HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.$HTTP_COOKIE_VARS['4images_lang'].'/main.php'))
{
$l = $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
}
}
P.S. I havent test it though.
why don't you read through the replies on page 2?
V@no posted the solution already... :wink:
while ($folder = @readdir($handle)){
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
with:$folders = array();
while ($folders[] = @readdir($handle)) {;}
sort($folders);
foreach ($folders as $folder)
{
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..")
{
Do you really need a completely different template?
Don't the lang-images do the trick? :)
[REMOVED]
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
and this://-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
4images v1.7.3 or newer:include_once(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!
u'll need delete from global.php:Code: [Select]define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
And then find:
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");Code: [Select]include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
and insert above this:Code: [Select]if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish
P.S. I've removed your page_header.php source, so it wont cloag up the search engine ;) next time if u want to show something like, attach the file as a .txt file ;) (or zip it)
#p.s. i paste the code on line 129 a shown above.....where?
With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish
What do I have to change to get rid of the
blah_deutsch
while ($folder = @readdir($handle)) {
if ($folder != "blah_deutsch") {
$lang_select .= ">".$folder."</option>\n";
}
}
$lang_select .= ">".$folder."</option>\n";
}
}
}
$lang_select = "";
while ($folder = @readdir($handle)) {
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
if ($folder != $config['language_dir']) {
$lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/english/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a> ";
}else{
$lang_select .= "<img src=\"".TEMPLATE_PATH."/images/".$folder."2.gif\" border=\"0\" alt=\"".$folder."\"> ";
}
}
}
while ($folder = @readdir($handle)) {
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
$lang_select .= "<option value=\"".$folder."\"";
// If the folder name matches the current language,
// show the option as selected
if ($folder == $config['language_dir']) {
$lang_select .= " selected=\"selected\"";
}
$lang_select .= ">".$folder."</option>\n";
}
}
$lang_select .= "</select>\n</form>";
while ($folder = @readdir($handle)) {
if ($folder != "blah_deutsch") {
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
$lang_select .= "<option value=\"".$folder."\"";
// If the folder name matches the current language,
// show the option as selected
if ($folder == $config['language_dir']) {
$lang_select .= " selected=\"selected\"";
}
$lang_select .= ">".$folder."</option>\n";
}
}
}
$lang_select .= "</select>\n</form>";
But you are although on the wrong way.
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
with:if ($config['language_dir_default'] != $config['language_dir']) $config['template_dir'] .= "_".$l;
The condition V@no used would return true when l=<lang> was append to the url so, if you append l=<default lang> it would also require additional template for default lang...
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;with:
withif ($config['language_dir_default'] != $config['language_dir']) $config['template_dir'] .= "_".$l;
Hi theOracle
I mean this part in the mod language select
http://www.4homepages.de/forum/index.php?topic=4743.msg35908#msg35908
Matthias
I have no idea what are u talking about, but this is what you wrote before:
if ($config['language_dir_default'] != $config['language_dir']) $config['template_dir'] .= "".$l;
Nun noch eine Frage.
Ich möchte auch einige Beschreibungen der Bilder und Kategoerien sowohl in deutsch als auch in englisch anzeigen lassen.
Muss ich die Texte in der main.php (english und deutsch) abspeichern?
Was muss ich auf der Website einbauen, um dies anzuzeigen?
Ein kleines Beispiel wäre sehr hilfreich.
Danke
Grüsse aus Hamburg
Steffen
What do you think? Is this O.K. to take out the _ from yopur code, or could it cause some problems.
It seems to me everything is O.K.
as long as your template folder does not contein " _ " in it, (i.e. defaultdeutsch) its fine.
Ich habe den MOD gefunden http://www.4homepages.de/forum/index.php?topic=6749.0
Anschließend habe ich noch das Mulitlanguage Mod installiert und nun ist es auch möglich die Kategorien und Bildernamen in Deutsch und Englisch anzuzeigen.
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!
u'll need delete from global.php:Code: [Select]define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
and this:
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");Code: [Select]//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
And then find:Code: [Select]include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
and insert above this:Code: [Select]if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
the new code from first step in this topic:
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555
try to move it aboveCode: [Select]if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
$config['language_list'] = "(".implode("|", $config['language_list_array']).")";
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
$l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
if (file_exists(ROOT_PATH.'lang/'.$l.'/main.php')) {
$config['language_dir'] = $l;
setcookie('4images_lang', $l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
}
}
else
{
if (isset($HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.$HTTP_COOKIE_VARS['4images_lang'].'/main.php'))
{
$config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
}
}
if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
$config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
with: $l = $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
oh, I see...
what if you replaceCode: [Select]$config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
with:Code: [Select]$l = $config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
:D nice solution of writing X yu BAM, Matthias :)
When X yu BAM helps me, I just want to thank X yu BAM and not tra-la-la-la BAM 8)That's the right way to do it :)
(X yu BAM: nothing against you or your nick... ;) )
I think you also know who is X yu BAM ... :mrgreen:
(X yu BAM: nothing against you or your nick... ;) )in russian their nick doesn't sound very nice...at all...8O
Please could someone have a look at my URL chosing language on top of my site.
Îáìåíèâàòüñÿ ëè÷íûìè ñîîáùåíèÿìè ñ ëþáûì ïîëüçîâàòåëåì ñàéòà,
кодировка в lang/russian/main.php в переменной $lang['charset'] правильная?Кодировка в lang/russian/main.php в переменной $lang['charset'] стоит "windows-1251".
в header.html таг {charset} есть?
В header.html тага {charset} нет. :(В этом и проблема. Проблема решена.
Может проблема не в этом? Пробовал по разному. Просто копировал:В header.html тага {charset} нет. :(В этом и проблема. Проблема решена.
И полностью менял файл header.html. Все без изменений. :|я конечно извиняюсь, но я не верю :P
я конечно извиняюсь, но я не верю :PНет, проверял не в Опере. Для себя еще раз проверил и поменял файл header на оригинал. Все равно ничего не дает.
Надеюсь проверяли не в Опере...
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
with:if (!defined('IN_CP') && (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l']))) {
if ($requested_l != $config['language_dir'] && file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
With: if (file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
i put {lang_select} on home.html works fine, select english and works
BUT :?
when i go to another page like search last images the language backs to the inital that is portuguese
note: im not log in, the page is for guests only
anyone????
regards
... <tr><td align="right">{lang_select}</td></tr> ...
... only on the right side ... than try this in your template ... :wink:Code: [Select]... <tr><td align="right">{lang_select}</td></tr> ...
{header}
{lang_select}
{header}
<div align="center"><center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="right">{lang_select}</td>
</tr>
</table>
</center></div>
//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
echo $lang['no_settings'];
exit;
}
while ($row = $site_db->fetch_array($result)) {
$config[$row['setting_name']] = $row['setting_value'];
}
$site_db->free_result();
// registering global variable "user_template"
if (!isset($user_template))
session_register("user_template");
// check global variable for Empty
if ($user_template=="" || empty($user_template))
$user_template = $config['template_dir'];
// set the Template if QueryString is not nothing
if (!empty($l) || $l != "")
$user_template = $l;
$config['template_dir'] = $user_template;
<form name="javascript:location.reload()" id="form1">
<select name="l" onchange="javascript:submit()">
<option value="">Sprache</option>
<option value="english">english</option>
<option value="deutsch">deutsch</option>
</select>
</form>
foreach ($HTTP_GET_VARS as $key => $val) {
Parse error: syntax error, unexpected T_AS in /home.xx.x/xxxx/www/x/includes/page_header.php on line 86
"charset" => $lang['charset'],
danach einfügen: "text1" => $lang['text1'],
usw.... <table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_vaelg_sprog}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">
<br />
{lang_select}
<br />
<br />
</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
Flyfreak
<tr>
<td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_vaelg_sprog}</td>
</tr>
<tr>
<td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_select_title}</td>
</tr>
$lang['select_title'] = "Select language";
"charset" => $lang['charset'],
"lang_select_title" => $lang['select_title'],
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!
u'll need delete from global.php:Code: [Select]define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
and this:
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");Code: [Select]//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
And then find:Code: [Select]include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
and insert above this:Code: [Select]if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish
P.S. I've removed your page_header.php source, so it wont cloag up the search engine ;) next time if u want to show something like, attach the file as a .txt file ;) (or zip it)
is it possible to update the code so it works with 4images 1.7.6Done (http://www.4homepages.de/forum/index.php?topic=4743.msg35908#msg35908)
Apparently the global.php is 1.7.6 is not the same as the old one :oops:
Is it possible to detect automatically the language (by IP or by OS language) if are not present cookie?
Is it possible to detect automatically the language (by IP or by OS language) if are not present cookie?
on Lanuage select is it possible to for user to see another template??
let's say i have english and farsi
i want the user when he chooses the farsi to get a totally different template!
u'll need delete from global.php:Code: [Select]define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
and this:
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");Code: [Select]//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
And then find:
4images older then v1.7.3:Code: [Select]include(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
4images v1.7.3 or newer:Code: [Select]include_once(ROOT_PATH.'lang/'.$config['language_dir'].'/main.php');
insert above:Code: [Select]if ($config['language_dir'] == $l) $config['template_dir'] .= "_".$l;
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/template.php');
$site_template = new Template(TEMPLATE_PATH);
With this change you will need create template for each language with this name format: <template name>_<language>
for example your default language is english and have also deutsch and spanish languages.
the default template used has name blah
Then you must have three templates with names:
blah
blah_deutsch
blah_spanish
P.S. I've removed your page_header.php source, so it wont cloag up the search engine ;) next time if u want to show something like, attach the file as a .txt file ;) (or zip it)
I'm sorry, what icon? I'm not familiar with "Buddy Mod", and don't know how it works...A screenshot of how it should look like and how it actually looks could possibly help.
I'm sorry, what icon? I'm not familiar with "Buddy Mod", and don't know how it works...A screenshot of how it should look like and how it actually looks could possibly help.
Hello V@no and thanks for your support .
The Buddy mod is here http://www.4homepages.de/forum/index.php?topic=19755.0.
Also please see atached 2 screenshots from english and romanian language (http://)
I'm sorry, what icon? I'm not familiar with "Buddy Mod", and don't know how it works...A screenshot of how it should look like and how it actually looks could possibly help.
Hello V@no and thanks for your support .
The Buddy mod is here http://www.4homepages.de/forum/index.php?topic=19755.0.
Also please see atached 2 screenshots from english and romanian language (http://)
You have to upload your romanian button in to your_template/images_romanian folder if you don't have one you should create him.
What you think will me the best sollution for set up the romanian language as default ?It is really up to you. ;)
What you think will me the best sollution for set up the romanian language as default ?It is really up to you. ;)
What you think will me the best sollution for set up the romanian language as default ?It is really up to you. ;)
Hello V@no . I have setup from admin romanian as default . the default template default and for english template default_ english . It 's working ok for romanian but when i try to select english the language is unchanged , in this mode will work just romanian . why ?
if (isset($HTTP_GET_VARS['l']) || isset($HTTP_POST_VARS['l'])) {
$requested_l = (isset($HTTP_GET_VARS['l'])) ? trim($HTTP_GET_VARS['l']) : trim($HTTP_POST_VARS['l']);
if (file_exists(ROOT_PATH.'lang/'.$requested_l.'/main.php')) {
if (!isset($HTTP_COOKIE_VARS['4images_lang'])) $l = $requested_l;
$config['language_dir'] = $requested_l;
setcookie('4images_lang', $requested_l, (time()+ 60 * 60 * 24 * 365), "/", "", 0);
}
}
else
{
if (isset($HTTP_COOKIE_VARS['4images_lang']) && file_exists(ROOT_PATH.'lang/'.$HTTP_COOKIE_VARS['4images_lang'].'/main.php'))
{
if ($HTTP_COOKIE_VARS['4images_lang'] != $config['language_dir']) $l = $HTTP_COOKIE_VARS['4images_lang'];
$config['language_dir'] = $HTTP_COOKIE_VARS['4images_lang'];
}
else
{
//http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
$lang_codes = array(
"aa"=>"afar","ab"=>"abkhazian","ae"=>"avestan","af"=>"afrikaans","ak"=>"akan","am"=>"amharic","an"=>"aragonese","ar"=>"arabic","as"=>"assamese","av"=>"avaric","ay"=>"aymara","az"=>"azerbaijani",
"ba"=>"bashkir","be"=>"belarusian","bg"=>"bulgarian","bh"=>"bihari","bi"=>"bislama","bm"=>"bambara","bn"=>"bengali","bo"=>"tibetan","br"=>"breton","bs"=>"bosnian",
"ca"=>"catalan","ce"=>"chechen","ch"=>"chamorro","co"=>"corsican","cr"=>"cree","cs"=>"czech","cu"=>"church_slavic","cv"=>"chuvash","cy"=>"welsh",
"da"=>"danish","de"=>"deutsch","dv"=>"divehi","dz"=>"dzongkha",
"ee"=>"ewe","el"=>"greek","en"=>"english","eo"=>"esperanto","es"=>"spanish","et"=>"estonian","eu"=>"basque",
"fa"=>"persian","ff"=>"fulah","fi"=>"finnish","fj"=>"fijian","fo"=>"faroese","fr"=>"french","fy"=>"frisian",
"ga"=>"irish","gd"=>"gaelic","gl"=>"galician","gn"=>"guarani","gu"=>"gujarati","gv"=>"manx",
"ha"=>"hausa","he"=>"hebrew","hi"=>"hindi","ho"=>"hiri_motu","hr"=>"croatian","ht"=>"haitian","hu"=>"hungarian","hy"=>"armenian","hz"=>"herero",
"ia"=>"interlingua","id"=>"indonesian","ie"=>"interlingue","ig"=>"igbo","ii"=>"sichuan_yi","ik"=>"inupiaq","io"=>"ido","is"=>"icelandic","it"=>"italian","iu"=>"inuktitut",
"ja"=>"japanese","jv"=>"javanese",
"ka"=>"georgian","kg"=>"kongo","ki"=>"kikuyu","kj"=>"kuanyama","kk"=>"kazakh","kl"=>"kalaallisut","km"=>"khmer","kn"=>"kannada","ko"=>"korean","kr"=>"kanuri","ks"=>"kashmiri","ku"=>"kurdish","kv"=>"komi","kw"=>"cornish","ky"=>"kirghiz",
"la"=>"latin","lb"=>"luxembourgish","lg"=>"ganda","li"=>"limburgan","ln"=>"lingala","lo"=>"lao","lt"=>"lithuanian","lu"=>"luba-katanga","lv"=>"latvian",
"mg"=>"malagasy","mh"=>"marshallese","mi"=>"maori","mk"=>"macedonian","ml"=>"malayalam","mn"=>"mongolian","mo"=>"moldavian","mr"=>"marathi","ms"=>"malay","mt"=>"maltese","my"=>"burmese",
"na"=>"nauru","nb"=>"norwegian","nd"=>"ndebele","ne"=>"nepali","ng"=>"ndonga","nl"=>"dutch","nn"=>"norwegian","no"=>"norwegian","nr"=>"ndebele","nv"=>"navajo","ny"=>"chichewa",
"oc"=>"occitan","oj"=>"ojibwa","om"=>"oromo","or"=>"oriya","os"=>"ossetian",
"pa"=>"panjabi","pi"=>"pali","pl"=>"polish","ps"=>"pushto","pt"=>"portuguese",
"qu"=>"quechua",
"rm"=>"romansh","rn"=>"rundi","ro"=>"romanian","ru"=>"russian","rw"=>"kinyarwanda",
"sa"=>"sanskrit","sc"=>"sardinian","sd"=>"sindhi","se"=>"sami","sg"=>"sango","si"=>"sinhala","sk"=>"slovak","sl"=>"slovenian","sm"=>"samoan","sn"=>"shona","so"=>"somali","sq"=>"albanian","sr"=>"serbian","ss"=>"swati","st"=>"sotho","su"=>"sundanese","sv"=>"swedish","sw"=>"swahili",
"ta"=>"tamil","te"=>"telugu","tg"=>"tajik","th"=>"thai","ti"=>"tigrinya","tk"=>"turkmen","tl"=>"tagalog","tn"=>"tswana","to"=>"tonga","tr"=>"turkish","ts"=>"tsonga","tt"=>"tatar","tw"=>"twi","ty"=>"tahitian",
"ug"=>"uighur","uk"=>"ukrainian","ur"=>"urdu","uz"=>"uzbek",
"ve"=>"venda","vi"=>"vietnamese","vo"=>"volapük",
"wa"=>"walloon","wo"=>"wolof",
"xh"=>"xhosa",
"yi"=>"yiddish","yo"=>"yoruba",
"za"=>"zhuang","zh"=>"chinese","zu"=>"zulu",
);
//http://www.thefutureoftheweb.com/blog/use-accept-language-header
$langs = array();
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
if (count($lang_parse[1])) {
// create a list like "en" => 0.8
$langs = array_combine($lang_parse[1], $lang_parse[4]);
// set default to 1 for any without q factor
foreach ($langs as $key => $val) {
if ($val === '') $langs[$key] = 1;
}
// sort list based on value
arsort($langs, SORT_NUMERIC);
}
}
foreach ($langs as $key => $val)
{
$key = explode("-", $key);
if (isset($lang_codes[$key[0]]) && file_exists(ROOT_PATH.'lang/'.$lang_codes[$key[0]].'/main.php'))
{
$config['language_dir'] = $lang_codes[$key[0]];
if ($lang_codes[$key[0]] != $config['language_dir']) $l = $lang_codes[$key[0]];
setcookie('4images_lang', $lang_codes[$key[0]], time()+ 60 * 60 * 24 * 365, "/", "", 0);
break;
}
}
unset($langs);
unset($lang_codes);
}
}
1) I've asked you once before, please do not reply twice to the same topic, edit your previous reply with additional info, questions, unless someone replied after you or if no one replied for a long time. I ask you that, because if you look at the history of your replies, you'd see that almost all your recent replies to any topics are following by one to three additional replies by you. It is called "flood". Even though flooding is not in our forum's rules, I bet it's not granted on any forums.
2) more often then not it's more helpful see the original reply instead of just a quote from it, aka provide a link to the message you are referring to, along with the quote if you feel like it.. The original replies and replies before them can provide more useful information. A link to a specific reply can be found at it's headline or icon.
3) did you try the code? from what I recall it has nothing to do with version A or B and from what I see it should work on v1.7.6 as well.
P.S.
Please don't get offended by what I said or will say, it wasn't my intention. But you seems to rush into post a reply without first checking if it's a mistake you made, then after 5 minutes with "gee I forgot something" post another reply...please don't do that, edit your previous post instead.
I understand you don't have enough time to do everything you'd like to do, we all like that, but if you'd spent the same amount of time that required to post a message on the forum, to actually double check your steps, you'd probably save a lot of time for yourself then waiting for the other's replies ;)
Sorry for the lecture.
Hi VanoI've updated the cookie code. For people previously installed that code I've left the old code at the bottom of the post, so they know what to search for.
this Mod ist not compatibel with
http://www.4homepages.de/forum/index.php?topic=24526.0
problem with cookies
http://www.4homepages.de/forum/index.php?topic=4743.msg31555#msg31555
http://www.4homepages.de/forum/index.php?topic=24526.msg134385#msg134385
can you help us?
so.... if I edit a previous poist will it reappear at the end of the thread as a new post would?
<?php
global $site_sess;
?>
» <a href="<?=$site_sess->url(ROOT_PATH."index.php?template=imprint")?>">Imprint</a><br />
» <a href="<?=$site_sess->url(ROOT_PATH."index.php?template=contact")?>">Contact</a><br />
» <a href="<?=$site_sess->url(ROOT_PATH."index.php?template=links")?>">Links</a><br />
Hello, the "url" of the links is for example know: "details.php?image_id=11191&l=deutsch"
Is there any way to hide the "&l=deutsch" or "&l=english" from all links on the 4images website?
Thanks for help
<?php
global $config;
if ($config['language_dir'] == "russian")
{
?>
this text/html will be only visible when selected russian
<?php
}
?>
URL | COOKIE VALUE |
index.php | "deutsch" or "" [no cookie] |
index.php?l=english | "english" |
index.php?l=french | "french" |
URL | COOKIE VALUE |
index.php?l=deutsch | deutsch |
index.php?l=english | english |
index.php?l=french | french |
$lang_select .= "<a class=\"lang\" href=\"".$lang_url.(preg_match("/deutsch/i",$folder) ? "" : ((preg_match("/\?/", $lang_url) ? "&" : "?")."l=".$folder))."\" onMouseOver=\"(window.status='$folder'); return true\" onMouseOut=\"window.status=''; return true\"><img src=\"".TEMPLATE_PATH."/images/".$folder.".gif\" border=\"0\" alt=\"".$folder."\"></a> ";
How about to make different fields in admin panel with title and description for each language?http://www.4homepages.de/forum/index.php?topic=6749.msg29540#msg29540
User-agent: *
Disallow: /*?l=english(&|$)
Disallow: /*?l=italian(&|$)
Disallow: /*?l=spanish(&|$)
Disallow: /*?l=french(&|$)
Disallow: /*?search_keywords(&|$)
gibt es bei der verwendung dieses MODs eigentlich für die suchmaschinen einen duplicate content problem?nein gibt es keine, bei der standard sprache hast du das anhängseln nicht, und google klickt nicht auf eine andere sprache. :)
gibt es bei der verwendung dieses MODs eigentlich für die suchmaschinen einen duplicate content problem?nein gibt es keine, bei der standard sprache hast du das anhängseln nicht, und google klickt nicht auf eine andere sprache. :)
auf meiner seite kannst du dir das ansehn...
...deine Seite mit gleichen Inhalten sowohl auf deutsch als auch auf englisch gelistet.....das hätte ich nicht gedacht..
....das wird definitiv von gogle abgestraft!)nein google ist das vollkommen egal.
Quote....das wird definitiv von gogle abgestraft!)nein google ist das vollkommen egal.
...Wie kann ich die Fehlermeldung vermeiden?
..