[TYPO3-english] Language key in url

Richard Jäger richard_j at arcor.de
Wed Jun 3 13:50:02 CEST 2009

right now users can switch language by clicking on german or english on 
the frontpage, it just adds an L=X, like index.php?id=383&L=0

But im using realurl, so its a bit "ugly". If ur surfing the english 
site the url looks like www.xxx.de/en/bookshop.html and in german 

So my question is now, is it possible to change the "de" or "en" if 
someone clicks on a language?

Im using a .inc file for that:

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('*', 

$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 
width="7" height="10" alt="" />';
$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[] = ($GLOBALS['TSFE']->sys_language_uid==0?$pointer:'').'<ul 
src="fileadmin/templates/images/right_arrow.gif" alt=""/> <a 
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==1?$pointer:'').'<li><img 
src="fileadmin/templates/images/right_arrow.gif" 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 
$content = ''.implode('',$flags).'';

Thanks soooo much in advance, i hope u understand my question :)

More information about the TYPO3-english mailing list