[TYPO3-german] ob eine übersetzung existiert

Stefan Precht sprecht at symplasson.de
Wed Sep 26 00:41:02 CEST 2007


Hi Ralph!

Zum Anzeigen von Sprachwechsel Buttons nutze schlicht eine eigene PHP 
Datei mit beispielsweise folgendem Inhalt

###
require_once(PATH_tslib.'class.tslib_content.php');


$lcObj = new tslib_cObj();

  // First, select all pages_language_overlay records on the current 
page. Each represents a possibility for a language.
$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"];
}

// 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 = '> ';

// 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[] = '<a 
href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=0">'.($GLOBALS["TSFE"]->sys_language_uid==0?$pointer:"").'deutsch</a>';
$flags[] = ($langArr[1]?'<a 
href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=1">'.($GLOBALS["TSFE"]->sys_language_uid==1?$pointer:"").'english</a>':"english");
*/

$flags = array();
$flags[] = '<a 
href="http://DOMAIN/'.$lcObj->getTypoLink_URL($GLOBALS["TSFE"]->id,$_GET).'">'.($GLOBALS["TSFE"]->sys_language_uid==0?$pointer:"").'deutsch</a>';
$flags[] = ($langArr[1]?'<a 
href="http://DOMAIN/'.$lcObj->getTypoLink_URL($GLOBALS["TSFE"]->id,$_GET).'">'.($GLOBALS["TSFE"]->sys_language_uid==1?$pointer:"").'english</a>':"english");

// 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 = '<ul class="menu_level1"><li>' . $flags[0] . 
'</li>'.($langArr[1]?'<li>' . $flags[1] . '</li>':'').'</ul>';

###

Viele Grüße,
Stefan

  Ralph Grier wrote:
> Hallo Zusammen,
> 
> Weist jemand wie man von innerhalb typoscript ermittelt ob eine übersetzung
> für eine bestimmte Seite existiert fuer eine bestimmte sprache.
> 
> z.b. ich will in typoscript ermitteln " existiert die seite wo ich jetzt bin
> auf sprache L=2 "
> Falls Ja :
>    xxxx
> Falls Nein:
>    yyyyy
> 
> vielen dank im voraus.


More information about the TYPO3-german mailing list