[TYPO3-dev] Alter foreign_table_where to select items from parent page

Mathias Schreiber [TYPO3] mathias at typo3.org
Tue Apr 24 14:11:52 CEST 2007


Brian Bendtsen schrieb:
> And I thought there might be a simple solution. I have to say, im new at 
> TYPO3 extension programming and php. I have only made changes to the 
> pi1/class.tx_ebbolig_pi1.php.

Ok, this makes things a bit tricky...

> If I understand this correctly, I have to create a file: 
> class.tx_myplugin_something.php and create a method/function for filling 
> the select box by returning a recordset?

No, the documentation says you need to return an ARRAY.
Try this:
$retVal = 
array(array('0'=>'value_to_save_in_db','1'=>'label_to_show_in_BE');
return $retVal;

> Im not sure how to add the class to ext_localconf.php? Tried looking in 
> this file in some other extension, that didn't help much.

include_once(t3lib_extMgm::extPath($_EXTKEY).'class.tx_wmdbtca2fe_itemsProcFunc.php');
Exchange the classname with the proper classname.
I included it in ext_tables.php, but localconf should work too.

> So far my class looks like this:
> 
> class tx_ebbolig_afdeling {
> 
>  function main() {
>   $query = "SELECT * FROM tx_ebbolig_afdeling INNER JOIN pages ON 
> tx_ebbolig_afdeling.pid = pages.pid WHERE pages.uid = '###CURRENT_PID###'";
>   $res = mysql(TYPO3_db, $query);
>   $row = mysql_fetch_array($res);
>   return $row;
>  }
> }
> 
> Am I totally lost or?

Pretty much, yes.
It is important to read and understand the documentation.

Another thing is that I am not sure if "###CURRENT_PID###" is available 
in your php class.

Mathias




More information about the TYPO3-dev mailing list