[Typo3] <itemsProcFunc> in flexform?
joachim rinck
joachim.rinck at tros.nl
Wed Nov 16 10:27:00 CET 2005
Hi there,
I've been searching for hours now but I don't find anything that makes
my itemsProcFunc work in flexform. It is working in ext_tables.php but I
really want the value to be stored in flex. Also i recently read that
adding fields to tt_content for some extension is highly discouraged.
Could someone please help me, point me to working documentation or send
me a working example? Here is my flexform and the itemsprocfunc code:
<tx_persons_select>
<TCEforms>
<label>person</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LIST</numIndex>
<numIndex index="1">LIST</numIndex>
</numIndex>
</items>
<minitems>0</minitems>
<maxitems>1</maxitems>
<size>3</size>
<itemsProcFunc>class.tx_persons_select->main</itemsProcFunc>
</config>
</TCEforms>
</tx_persons_select>
and:
class tx_persons_select {
var $id;
function main(&$params,&$pObj) {
$sSelect = 'uid, firstname, infix, surname ';
$sFrom = 'tx_persons_person';
if(t3lib_div::_GP("tdebug")) {
$this->id = t3lib_div::_GP('id');
$this->id = 208;
echo "<b>flexform query</b> line: ".__LINE__.", file: ".__FILE__ ;
echo "<br><div style=\"color:#ff0000\">";
echo
$GLOBALS['TYPO3_DB']->SELECTquery($sSelect,$sFrom,$sWhere,'','');
echo "</div><br>";
//echo t3lib_div::debug($aFlexData,'aFlexData');
}
$aSelect=array();
$dRes =
$GLOBALS['TYPO3_DB']->exec_SELECTquery($sSelect,$sFrom,'','','');
$i=1;
$params['items']=Array();
$params['items'][]=Array('Select a person for the TIP',0);
while ($aResult = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dRes)) {
$fullname = $aResult['firstname'].' '.$aResult['infix'].'
'.$aResult['surname'];
$params['items'][]=Array($fullname, $aResult['uid']);
}
}//function main
}//class
Please help! Thanks a lot,
Joachim
More information about the TYPO3-english
mailing list