rtgx

Typo3 Localize your own extensions

When you try to write your own front end (FE) extensions with Typo3 there are common pitfalls. First of all be sure you enabled your table to hold the information. (Can be done very easy via the kickstarter). Next be sure you don’t query do much information of your table. All you need are the row where ”sys_language_uid=0”. Your translation is made via the getRecordOverlay! This short code snippet may help you to resolve your problems:

function readDBData( $table, $where ) {

$back = array();

if ( $where!=”” )
$where.= ” AND ”;
$where .= ” deleted=0 AND hidden = 0 AND sys_language_uid=0”;

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( ’*’, $table, $where );
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if ($GLOBALS['TSFE']->sys_language_content) {
$OLmode = ($this->sys_language_mode == ’strict’?’hideNonTranslated’:’');
$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay( $table, $row, $GLOBALS['TSFE']->sys_language_content, $OLmode);
}
$back[] = $row;
}
return $back;
}

By Roger Sennert

getRecordOverlay

t3lib_pageSelect::getRecordOverlay

(

$

table,

row,

sys_language_content,

OLmode = ''

 

)

Creates language-overlay for records in general (where translation is found in records from the same table)

Parameters:

table

string 

Table name

row

array 

Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']

sys_language_content

integer 

Pointer to the sys_language uid for content on the site.

OLmode

string 

Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false)

Returns:

mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is hideNonTranslated then it will return false if no translation is found.

Generátor typoscriptu

Vytvára typoscript pre bežné použitie. Generátor je jednoduchý na obsluhu, stačí vyplniť zopár položiek formulára.

Odkazy