[TYPO3] itemsProcFunc problem

Vincent Mans typo3.vincnet at gmail.com
Thu Aug 30 15:12:04 CEST 2007


Hello Typo people!

I realise that my question about itemsProcFunc might be too unclear. Since
there's no one response, I try to rephrase it.

Purpose: fetch data from a foreign table into a multi selectbox, so we see
values there in stead of uid (e.g. "hello" in stead of "5") - like for
example the Static Templates selection mechanism. When selected "hello" from
the rightside field with the 'items' to select from, this value is
transfered to the leftside called 'selected'. So far, nothing special. It's
documented that we can use itemsProcFunc for that.

My first question is: can values be fetched, or are it always uids? Because
I need the values in the fields.

My second question: how can I get this to work? I used my own script, but
also used scripts from others that proved to be working for them. But in my
case they're not. First, I get a list of uids + values in the 'items' field.
Second, I can select the uids, but not the values. See details below. To get
this working, do I need to hook on to some transfer classes/methods? If so,
which ones and what can I do there? And further: if it's not working as
expected, might this be an issue of version 4.1.2 - as it seems I'm the
first with this problem on this version?

Thanks again,
Vincent



Hi list,
>
> Problem with itemsProcFunc. I work with 4.1.2.
>
> It's about fetching data from a foreign table, and put it in select.
>
> The problem is: the uid field remains in the items field. It doubles up:
> first all uids, then all titles. So what I get is, for example:
>
> 5
> 6
> hello
> goodbye
>
> The uid of 'hello' is '5'.
>
> When I select an item, only the uid goes over to the selected field.
>
> Of course I tried several options and solutions from across the net etc.
> but unfortunately....
>
> Related question, that I couldn't test because of this, and that's not
> well documented I think: is the value passed from the foreign table to this
> table, or is still the uid passed?
>
>
> This is the part from the tca:
>
>     "tx_vincnetextranewsfield_work_signature" => Array (
>             "exclude" => 1,
>             "label" =>
> "LLL:EXT:vincnet_extranewsfield/locallang_db.php:tt_news.tx_vincnetextranewsfield_work_signature",
>
>             "config" => Array (
>                 "foreign_table" => "tt_news_xsign",
>                 "foreign_table_where" => "AND tt_news_xsign.pid=37",
>                 //"dontRemapTablesOnCopy" => "tt_news_xsign",
>                 "size" => 9,
>                 "minitems" => 0,
>                 "maxitems" => 3,
>                 "itemsProcFunc" =>
> "tx_ttnews_itemsProcFunc->user_signature",
>                 "allowNonIdValues" => 1,
>                 "wizards" => Array(
>
> This is the method in the class tx_ttnews_itemsProcFunc:
>
> function user_signature(&$params,&$pObj)    {
>         $columns  = 'title';
>         $table      = 'tt_news_xsign';
>         $where = 'deleted=0 AND hidden=0';
>         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($columns, $table,
> $where);
>              if (!$res) { // check for sql error
>                    echo('<hr>[File:'.__FILE__.' Func:'.__FUNCTION__.'
> Line:'.__LINE__.'] SQL Error:'.$GLOBALS['TYPO3_DB']->SELECTquery($columns,
> $table, $where));
>                    return FALSE;
>              }
>         while($row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)){
>             $params['items'][] = Array($row1['title']);
>
>         }
> }
>
> Greetz,
> Vincent
>


More information about the TYPO3-english mailing list