[Typo3] extension with language specific content *SOLVED*

T.Joga email at welho.com
Mon Dec 12 11:30:03 CET 2005


Getting content only for selected language wasnt too hard after all. 
This is what you have to add code written from the kickstarter (around 
line 67 or something - easy to find anyway):

// Make listing query, pass query to SQL database:
$table = 'tx_testthing_test'; //table name
$where = " AND sys_language_uid=".$GLOBALS['TSFE']->sys_language_uid; 
//lang id
$res = $this->pi_exec_query($table,0,$where);

I just cant understand how I managed to spent so freaking many hours to 
figure this out :/






> I couldnt figure out exactly how to use "tt_products"-method / table 
> library-plugin.
> 
> Anyway I want to keep this as simple as possible so I hope that this 
> could be done with slightly modified out-of-a-box-kickstarter code.
> 
> I havent advanced with this too much, only update I have is $cL variable 
> which holds currently selected language number. I anyway cant get how to 
> use it to select only fields where recurrent_language_id = $cL
> - it is there, I have checked ;)
> 
> Here is stripped kickstarter listView-function.., what parametres I 
> should insert to get the desired result?
> 
> Something like?: $this->internal['query'] = "WHERE sys_language_uid=$cL"
> 
> 
> function listView($content,$conf)   
> {
>  $this->conf=$conf; // Setting the TypoScript
>  $this->pi_setPiVarDefaults();
>  $this->pi_loadLL(); // LOCAL_LANG values (?)
>  $cL = $this->getCurrentLanguage();
>  $lConf = $this->conf['listView.'];
> 
>  // Initializing the query parameters:
>  list($this->internal['orderBy'],$this->internal['descFlag']) = 
> explode(':',$this->piVars['sort']);           
> 
> $this->internal['results_at_a_time']=t3lib_div::intInRange($lConf['results_at_a_time'],0,1000,30); 
> 
> 
>  $res = $this->pi_exec_query('tx_testthing_test',1);
>  list($this->internal['res_count']) = 
> $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
> 
>  // Make listing query, pass query to SQL database:
>  $res = $this->pi_exec_query('tx_testthing_test');
>  $this->internal['currentTable'] = 'tx_testthing_test';
> 
>  $fullTable='';    // Clear var;
>  $fullTable.=$this->pi_list_makelist($res);
>  return $fullTable."<br />".$cL;
> }
> 
> 
> 
> 
> 
> 
>  > do it like in tt_products which uses the Table Library for building the
>  > SQL queries
>  >
>  > $this->tt_products =
>  > t3lib_div::makeInstance('tx_ttproducts_product');
>  > $this->tt_products->init($this->LLkey);
>  >
>  > You have to build your own database class like class
>  > tx_ttproducts_product. It creates all necessary settings automatically
>  > from the TCA.
>  >
>  > Remove the methods you do not need.
>  >
>  >     function init($LLkey)    {
>  >         global $TYPO3_DB,$TSFE;
>  >
>  >         $this->table = t3lib_div::makeInstance('tx_table_db');
>  >         $this->table->setTCAFieldArray('tt_products');
>  >
>  >          if ($TSFE->config['config']['sys_language_uid']) {
>  >              $this->table->setLanguage ($LLkey);
>  >             $this->table->setTCAFieldArray('tt_products_language');
>  >          }
>  >     } // init
>  >
>  >
>  >
>  > Franz
> 
>> Hello
>>
>>> Hello! I am wondering how to make simple extension where content is 
>>> separated by the language.
>>> $this->query = "AND sys_language_uid='1'";
>>> $res = $this->pi_exec_query('tx_test_test');
>>>
>>> ..surprise, it didnt work..
>>> There is great language support in the "tt_news"-extension, but its a 
>>> bit too overkill example for my current knowhow of typo!
>>
>>
>>
> 



More information about the TYPO3-english mailing list