[TYPO3-dev] FlexForm dropdown list with data from "external" datbase

Christian Ludwig cl at viazenetti.de
Wed Mar 6 17:49:11 CET 2013


Hi Alex,

I think you will need a ProcFunc.
See http://wiki.typo3.org/Extension_Development,_using_Flexforms#Dynamic_Data_in_Flexforms

But the article is not realy up to date when developing an extension with Extbase.

If you simply use
	<itemsProcFunc>Tx_Myextension_Utility_FlexformDataProvider->getForeigntable</itemsProcFunc>
in your flexform xml the file
	/typo3conf/ext/myextension/Classes/Utility/FlexformDataProvider.php
is loaded by the autoloader (no include in ext_tables is required) and the method getForeigntable in the class Tx_Myextension_Utility_FlexformDataProvider will be executed.


This method could look like this (here an exaple for a local table)

	public function getForeigntable(array $config) {

		$sqlResult = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
				'title, info, someOtherIds',
				'tx_myExtension',
				'myCondition = 1'
		);

		$items = array();

		foreach ($item = $sqlResult) {
			$items[] = array($item['title'] . ' (' . $item['info'] . ')', $item['someOtherIds']);
		}
		sort($items);

		$config['items'] = array_merge($config['items'], $items);
		return $config;
	}


Christian

-----Original Message-----
From: typo3-dev-bounces at lists.typo3.org [mailto:typo3-dev-bounces at lists.typo3.org] On Behalf Of "Alexander Födisch"
Sent: Wednesday, March 06, 2013 2:56 PM
To: typo3-dev at lists.typo3.org
Subject: [TYPO3-dev] FlexForm dropdown list with data from "external" datbase

Hi,

is it possible to create a FlexForm dropdown list using a "external" MySQL database (not the Typo3 DB)?
I found a solution for run flexform with data from tables of the Typo3 database (e.g.
http://stackoverflow.com/questions/15221862/typo3-use-ts-in-flexform-or-flexform-in-flexform
<http://stackoverflow.com/questions/15221862/typo3-use-ts-in-flexform-or-flexform-in-flexform>
), but not for "connecting" FlexForm to an external one.

Thanks for any help!
Alex
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev





More information about the TYPO3-dev mailing list