Zum Inhalt springen

Update auf 6.1 und languageMenu.php

Erstellt am 21. Januar 2014 · Noch keine Antworten

Tags: PHP, Update & Upgrade, TYPO3 6.x, Frage

mamo ·

Hallo

Ich habe u.a. eine Website von Typo3 4.4.x auf 6.1.3 geändert. Alles klappt soweit, ausser dem Sprachwechsel.
Im BE sieht alles richtig aus, im FE werden die Flaggen nicht dargestellt, so dass die Sprache nicht gewählt werden kann. Der Quellcode bleibt an dieser Stelle leer.
Rufe ich aber eine englische Seite direkt auf mit ...index.php?id=25&L=1 ist alles korrekt vorhanden.

Ich vermute, dass im PHP Script irgend eine Funktion nicht mehr funktioniert.

Im Setup des Haupttemplates steht:

# SprachVariable L initialisieren
config.linkVars = L

# Standardsprache UID 0 -> Deutsch
config.sys_language_uid = 0
config.language = de
config.locale_all = de_CH.ISO8859-1

# English, sys_language.uid = 1
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = en
config.locale_all = en_UK
[global]

...

page.10 = TEMPLATE
page.10 {
...

  #Marker ###LANGUAGE###
  marks.LANGUAGE = PHP_SCRIPT
  marks.LANGUAGE.file = fileadmin/scripts/my_languageMenu.php
...

Die Datei my_languageMenu.php sieht so aus:

<?php
/***************************************************************
*  Copyright notice
*  
*  (c) 1999-2002 Kasper Skårhøj (kasper@typo3.com)
*  All rights reserved
*
*  This script is part of the Typo3 project. The Typo3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*  A copy is found in the textfile GPL.txt and important notices to the license
*  from the author is found in LICENSE.txt distributed with these scripts.
*
*
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
 * example_languageMenu.php
 *
 * THIS IS AN EXAMPLE designed to work with the official Typo3 testsite, section "Another site in the ..."
 *
 * @author    Kasper Skårhøj <kasper@typo3.com>
 */

if (!is_object($this)) die ('Error: No parent object present.');

// 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 = '<span class="pointer"><img src="fileadmin/template/images/flags/selected.gif" width="7" height="12"></span>'; //schwarzer Pfeil

// 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.
//Variante mit Flaggen:
$flags = array();
$flags[] = ($GLOBALS["TSFE"]->sys_language_uid==0?$pointer:"").'<a href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=0" target=_top><img src="fileadmin/template/images/flags/de.gif" width="20" height="12" alt="de"></a><span class="invis">.</span> ';
$flags[] = ($GLOBALS["TSFE"]->sys_language_uid==1?$pointer:"").'<a href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=1" target=_top><img src="fileadmin/template/images/flags/gb'.($langArr[1]?"":"_d").'.gif" width="20" height="12" alt="gb"></a><span class="invis">.</span> ';

$content = '<span>'.implode("",$flags).'</span>';
?>

Diese Datei musste ich schon mal anpassen, als PHP auf 5.3 umgestellt wurde.
Ich vermute, dass auch diesmal eine Funktion nicht mehr mit PHP 5.4 kompatibel ist.

Wo könnte der Fehler liegen?
Danke für Hinweise.