[Typo3] extension with language specific content

Franz Holzinger franz at fholzinger.com
Thu Dec 8 17:07:51 CET 2005


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!

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



More information about the TYPO3-english mailing list