[Typo3] Problem with flags on multilanguage site

Heckmaenner Webmaster webmaster at heckmaenner.de
Mon Nov 14 13:01:12 CET 2005


I have successfully configured my site to support multi languages. The default language (uid=0) is German and the first alternative language (uid=1) is English. I have translated the start page and some sample pages. The flags are displayed, however, the English one always appears "dimmed". It still works though, which means if I click on the English one it will display the English content and the "L=1" is addedd in the address bar.
I can only think of a problem with the PHP script which looks as follows:

<?php
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 = '<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[2]?'':'_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 = '<div id="box-language-menu">'.implode('',$flags).'</div>';
?>

Anyways, my knowledge is limited so I can not find out what may be wrong with it.

The site can be seen at http://www.heckmaenner.de

Thanks for any help,
Andy


More information about the TYPO3-english mailing list