[TYPO3-english] formhandler: pre-loading values from file
Reinhard Führicht
rf at typoheads.at
Mon Mar 21 17:43:56 CET 2011
Am 2011-03-21 14:02, schrieb Claudio Strizzolo:
> Hi all,
> I am trying to update a mailformplus setup to formhandler.
> I need to load the values to be used in a<select> form field from a text
> file:
>
> Donald|Donald.Duck at example.com
> Mickey|Mickey.Mouse at example.com
>
> Basically, I need the first field to appear in the select menu, and the
> sedcond field to be assigned as the value.
>
> In mailformplus a preprocUserFunc was used:
>
> plugin.tx_thmailformplus_pi1.preprocUserFunc = fileadmin/somewhere/
> my_preproc.php:my_preproc->doit
>
> How can I do the same using formhandler? I read about the
> Preprocessor_LoadDB preprocessor, but that is a different case (DB instead
> of text file).
>
> Any hints?
>
> Thanks in advance,
>
> Claudio
Hi Claudio,
you can write a custom PreProcessor instead of the userFunc.
Example:
Put the PreProcessor in fileadmin/scripts/.
In TS:
plugin.Tx_Formhandler.settings {
# Tell Formhandler to look in other paths than typo3conf/ext/ for
class files too
additionalIncludePaths.1 = fileadmin/scripts/
# User your own PreProcessor
preProcessors {
1.class = Tx_Formhandler_PreProcessor_DoSomething
1.config {
foo = bar
}
}
}
The PreProcessor has to extend AbstractPreProcessor.
You have access to the GET/POST values via $this->gp.
You can access the configuration for your PreProcessor (everything in
the "config" section) via $this->settings.
For all other stuff you can have a look at the existing PreProcessors to
understand how it works.
NOTE: The PreProcessor MUST return $this->gp!
Regards,
Reinhard
More information about the TYPO3-english
mailing list