[TYPO3-project-formidable] How work the calls fromuserobj property?
Asbjørn Morell
atmorell at gmail.com
Fri May 11 11:38:43 CEST 2007
Rego,
Please post here extension is done. Who knows maybe Jerome will include it
in the future. :)
I see where you are going with this.Where have you placed the function? Is
it in the fe plugin _pi.php fle? (before you call formidable)
Best regards.
Asbjørn Morell.
"Manuel Rego Casasnovas" <mrego at igalia.com> wrote in message
news:mailman.213661.1178873109.21067.typo3-project-formidable at lists.netfielders.de...
Hi Asbjørn!
My previous example was a generic example, in particular for example I
get the countries from static_countries table.
I call this function in a LISTBOX renderlet:
<renderlet:LISTBOX name="country" label="country">
<data>
<userobj>
<extension>this</extension>
<method>_getCountries</method>
</userobj>
</data>
</renderlet:LISTBOX>
Function code:
/**
* Get a list of pairs uid - country (value - caption) from the table
static_countries
*
* @return array Array of pairs uid - country (value - caption)
*/
function _getCountries() {
// Obtain the countries from static_countries
$table = 'static_countries';
$countries = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,
cn_short_en', $table,
$GLOBALS['TSFE']->sys_page->enableFields($table), '',
'cn_short_en');
$toReturn = Array();
// For each country
foreach ($countries as $country) {
array_push($toReturn, array(
'value' => $country['uid'],
'caption' => $country['cn_short_en']
);
}
return $toReturn;
}
We are developing several functions to get the static data from database
tables to put them in FORMidable forms. When we'll finish our work we'll
up a new extension with this.
Best regards,
Rego
--
http://www.igalia.com
El vie, 11-05-2007 a las 10:08 +0200, Asbjørn Morell escribió:
> Hello Rego
>
> You want to generate a list from a database table right? This is somehing
> I
> have tried to do a few times (failed so far) Could I pease have a look at
> your _getList function ? I would like to see how you access the database
> with the TYPO3 API.
>
> Best regards.
> Asbjørn Morell.
>
>
>
>
>
>
> "Manuel Rego Casasnovas" <mrego at igalia.com> wrote in message
> news:mailman.213551.1178869453.21067.typo3-project-formidable at lists.netfielders.de...
> > Hello everybody.
> >
> > I've been test differents places where I use userobj to call a function.
> >
> > First I use userobj inside renderlet data property, the next way:
> > <renderlet:LISTBOX name="list">
> > <data>
> > <userobj>
> > <extension>this</extension>
> > <method>_getList</method>
> > <params>
> > <param>
> > <name>var</name>
> > <value>my_value</value>
> > </param>
> > </params>
> > </userobj>
> > </data>
> > </renderlet:LISTBOX>
> >
> > In my function (_getList) I receive three params:
> > 1. An array with some information (I don't know what this information
> > means)
> > 2. An array with the params
> > 3. A tx_ameosformidable object
> >
> >
> > However when I call a personal function inside renderlet search/override
> > property:
> > <renderlet:TEXT name="text">
> > <search>
> > <overridesql>
> > <userobj>
> > <extension>this</extension>
> > <method>_getSQL</method>
> > <params>
> > <name>var</name>
> > <value>my_value</value>
> > </params>
> > </userobj>
> > </overridesql>
> > </search>
> > </renderlet:TEXT>
> >
> > In my function (_getSQL) I only receive two params:
> > 1. An array with some information
> > 2. A tx_ameosformidable object
> >
> > I don't receive the params.
> >
> >
> > What means the first param that I receive?
> > Somebody knows because exists that difference?
> >
> >
> > Best regards and thanks for your time ;-)
> > Rego
> >
> > ---
> > http://www.igalia.com
> >
>
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable
More information about the TYPO3-project-formidable
mailing list