Zum Inhalt springen

Standardtext bei keiner Übersetzung

Erstellt am 1. August 2004 · 1 Antwort · letzte Antwort am 2. August 2004

Tags: Frage

getimo ·

Wie kann ich Typo dazu bringen, dass er immer einen Standardtext (natürlich in der jeweiligen Sprache) anzeigt, wenn für diese Seite noch keine Übersetzung vorgesehen ist?

Vielen Dank voraus für jede Hilfe!

Gruß

getimo

tomww ·

Ich habe eine Lösung gebaut, die immer wenn es keine Seite in Englisch gibt die englische Startseite aufruft. Bau Dir doch das Skript entsprechend um, dass anstatt index.php?id=1&L=1 bei Dir dann id=XYZ steht (also Deine Seite ...)

<?php
/***************************************************************
*  Copyright notice
*  
*  (c) 1999-2004 Kasper Skaarhoj (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!
***************************************************************/
/**
 * Creates a language-selector menu with one flag, for either English or German language supported on the site.
 * If there is no English page available the link will point to the English starting page.
 *
 * This script is based on an example by Kasper Skaarhoj and adjusted by Thomas Walter 
 * 
 * original:
 * $Id: example_languageMenu.php,v 1.4 2004/03/22 15:46:24 typo3 Exp $
 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
 * XHTML compliant
 *
 * @author	Thomas Walter <info@wnets.de>
 */

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'];
}

// Select a flag an set a link (see above)  

If ($GLOBALS['TSFE']->sys_language_uid == 1)
{
	$langFlag = '<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="1" border="0" alt="Deutsche Version" title="Deutsche Verison" /></a>';
}

If ($GLOBALS['TSFE']->sys_language_uid == 0)
{
	IF (!$langArr[1])
	{	
		$langFlag = '<a href="'.htmlspecialchars('index.php?id=1&L=1').'" target="_top"><img src="media/uploads/flag_uk.gif" width="21" height="13" hspace="1" border="0" alt="English version" title="English verison" /></a>';
	}
    else {$langFlag = '<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=1').'" target="_top"><img src="media/uploads/flag_uk.gif" width="21" height="13" hspace="1" border="0" alt="English version" title="English verison" /></a>';
	}
}

$content = $langFlag;
?>

Tom