[TYPO3-dev] FCE with userFunc from extension

Jigal van Hemert jigal at xs4all.nl
Tue Apr 28 09:45:19 CEST 2009


Hi devs,

I added a class with a function to one of my extensions and I want to call
it from the TS inside an FCE.

in typo3conf/ext/my_ext/class.tx_myext_user.php is:

class tx_myext_user {

  function mytest($content, $conf) {

    $content = $conf['test'];
...

    return $content;
  }
}

In the FCE are a number of non-mapped fields and one mapped field:

<field_test type="array">
	<type>element</type>
	<tx_templavoila type="array">
		<title>Test number</title>
		<sample_data type="array">
			<numIndex index="0">0</numIndex>
		</sample_data>
		<eType>input</eType>
		<TypoScript><![CDATA[
		includeLibs.tx_myext_user = EXT:my_ext/class.tx_myext_user.php
		10 = USER_INT
		10 {
			userFunc = tx_myext_user->mytest
			t1.field = field_1
			t2.field = field_2
			t3.field = field_3
			t4.field = field_4
			test.field = field_test
		}
		]]>
		</TypoScript>
		<proc type="array">
			<HSC type="integer">1</HSC>
		</proc>
	</tx_templavoila>
	<TCEforms type="array">
		<config type="array">
			<type>input</type>
			<size>6</size>
			<eval>trim</eval>
		</config>
		<label>Test number</label>
	</TCEforms>
</field_test>


All the FCE outputs is:

<div id="myext"><!--INT_SCRIPT.05e1e43c4a8c74f58e78b8de8c0d5239--></div>

I can only find examples with a userFunc in a seperate file in fileadmin.
Can't I use EXT:<extname>/<script>.php?

Help? :-)

-- 
Jigal van Hemert.





More information about the TYPO3-dev mailing list