Zum Inhalt springen

Problem bei Sprachwahl auf Startseite

Erstellt am 16. November 2004 · 7 Antworten · letzte Antwort am 20. November 2004

Tags: Frage

Jobock ·

Nach Eingabe der URL erscheint meine Frontpage (Weiterleitung mittels Shortcut).
In der URL-Zeile des Browsers steht aber noch
www.meineurl.de statt www.meineurl.de/index.php?id=1

Wenn ich nun die Sprache auswählen möchte, kommt die Fehlermeldung:
The requested URL /index.php&L=2 was not found on this server.

Es fehlt in der URL die Übergabe der ID:
index.php&L=2 statt index.php?id=1&L=2
Ich muss also zuerst irgendeine Seite anclicken, bevor ich die Sprache auswählen kann.

Hat jemand die Lösung für dieses Problem? Besten Dank

walter71 ·

Hallo

Deine wahrscheinlich als Test "www.meineurl.de" gemeinte URL ist nicht gerade eine gute Idee, sie als Link anzubieten ...

mstuebner ·
Jobock schrieb

Es fehlt in der URL die Übergabe der ID:
index.php&L=2 statt index.php?id=1&L=2
Ich muss also zuerst irgendeine Seite anclicken, bevor ich die Sprache auswählen kann.

Ohne jede sachdienliche Information? Schwerlich, es macht ja nicht jeder Deine Fehler nach. 🙂

Ich schätze mal, dass Du einen Fehler in den Sprach-Conditions im Roottemplate hast. Kann man aber ohne Deinen Code nur raten.

Jobock ·

Ich kann ja gerne mal die Einstellungen aus dem Setup einfügen:

### Einstellung der Sprache
# SprachVariable L initialisieren 
config.linkVars = L 

# Deutsch Standardsprache UID 0
config.sys_language_uid = 0 
config.language = de 
config.locale_all = de_DE 

# Englisch, sys_language.uid = 2
[globalVar = GP:L = 2] 
config.sys_language_uid = 2
config.language = en
config.locale_all = english
[global]

Und dann gibt es noch Einstellungen, um den Seitentitel in der URL anzuzeigen

config.simulateStaticDocuments = 1
config.simulateStaticDocuments_addTitle = 30
config.simulateStaticDocuments_noTypeIfNoTitle = 1

Ich gebe auch gerne noch mehr Code an - nur weiß ich nicht, welchen genau...

mstuebner ·
Jobock schrieb
### Einstellung der Sprache
# SprachVariable L initialisieren 
config.linkVars = L 

# Deutsch Standardsprache UID 0
config.sys_language_uid = 0 
config.language = de 
config.locale_all = de_DE 

# Englisch, sys_language.uid = 2
[globalVar = GP:L = 2] 
config.sys_language_uid = 2
config.language = en
config.locale_all = english
[global]

Und bei mir sieht das so aus:

config.linkVars = L 

[globalVar = GP:L = 0]
  config.sys_language_uid = 0
  config.language = de
  config.locale_all = de_DE 

[globalVar = GP:L = 1]
  config.sys_language_uid = 1
  config.language = en
  config.locale_all = english 

[GLOBAL]

und ich sehe keinen Unterschied, sieht man mal von den abweichenden Sprach-IDs ab. Das ist seltsam.

Jobock ·

Vielleicht stimmt ja auch mein Sprachauswahlscript nicht. Hier mal gepostet:

<?php
$query = "SELECT * FROM pages_language_overlay WHERE pid=".$GLOBALS["TSFE"]->id.$GLOBALS["TSFE"]->sys_page->enableFields("pages_language_overlay")." GROUP BY sys_language_uid";

$res = mysql(TYPO3_db,$query);

$langArr=array();
while($row=mysql_fetch_assoc($res)) {
$langArr[$row["sys_language_uid"]]=$row["title"];
}

$pointer = '';
$flags = array();
$currentLink = t3lib_div::linkThisScript();

$langSwitch = $GLOBALS["TSFE"]->config["config"]["lang_switch"];

if((count($langArr) != 0) && ($langSwitch != "OFF")) {
if(strpos($currentLink,'&L=0')) {
$link0 = '"'.$currentLink.'"';
$link1 = '"'.str_replace('&L=0','&L=2',$currentLink).'"';
} elseif(strpos($currentLink,'&L=2')) {
$link0 = '"'.str_replace('&L=2','&L=0',$currentLink).'"';
$link1 = '"'.$currentLink.'"';
}else {
//$link0 = '"'.'index.php?id='.$GLOBALS["TSFE"]->id.'&L=0'.'"';
//$link1 = '"'.'index.php?id='.$GLOBALS["TSFE"]->id.'&L=2'.'"';
$link0 = '"'.$currentLink.'&L=0'.'"';
$link1 = '"'.$currentLink.'&L=2'.'"';
}
$flags[] = '&nbsp;<b>&middot;</b>&nbsp;<a href='.$link0.' target=_top class="generic">deutsch</a>&nbsp;';
$flags[] = '&nbsp;<b>&middot;</b>&nbsp;<a href='.$link1.' target=_top class="generic">english</a>&nbsp;';

$content = ''.implode("",$flags).'';
} else {
$content ="";
}

?>

mstuebner ·
Jobock schrieb

Vielleicht stimmt ja auch mein Sprachauswahlscript nicht. Hier mal gepostet

Das sieht völlig anders aus:

 <?
// First, select all pages_language_overlay records on the current page. Each represents a possibility for a language.
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages_language_overlay', 'pid='.intval($GLOBALS['TSFE']->id).$GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay'), 'sys_language_uid');

$langArr = array();

while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
{
        $langArr[$row['sys_language_uid']] = $row['title'];
}

// Little red arrow, which is inserted to the left of the flag-icon if the
// TSFE->sys_language_uid equals the language uid (notice that 0=english,
// 1=danish and 2=german is SPECIFIC to this database, because these numbers
// refer to uid's of the table sys_language)

$pointer = '<img src="t3lib/gfx/content_client.gif" width="7" height="10" align="middle" alt="" />';

// Set each icon. If the language is the current, red arrow is printed to the
// left. If the language is NOT found (represented by a pages_language_overlay
// record on this page), the icon is dimmed.

$flags = array();

$flags[] = ($GLOBALS['TSFE']->sys_language_uid==0?$pointer:'').'<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=0').'" target="_top"><img src="media/uploads/flag_de.gif" width="21" height="13" hspace="5" border="0" alt="" /></a>';

$flags[] = ($GLOBALS['TSFE']->sys_language_uid==1?$pointer:'').'<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=1').'" target="_top"><img src="media/uploads/flag_uk'.($langArr[1]?'':'_d').'.gif" width="21" height="13" hspace="5" border="0" alt="" /></a>';

// Make the little menu. Notice, the menu does ONLY transfer the page-id and the "L" variable
// (which is also SPECIFIC for this website because "L" has been used in the extension template
// used to control the language setup)

$content = '<table border="0"  vallign="middle" cellpadding="0" cellspacing="0"><tr><td><img src="clear.gif" width="30" height="1" alt="" /></td><td>'.implode('',$flags).'</td></tr></table>';

?>
Jobock ·

Ich habe versucht, das Standardscript so umzubauen, dass ich nicht die Grafiken sondern normale Textlinks verwenden kann.