[Typo3] extension get values from fce-fields
Henry Wilhelm
henry at hexhe.de
Thu Sep 29 12:25:37 CEST 2005
Hi, all,
at first i have a FCE with two fields and i would like to get the values
of both fields with a php-script, not with typoscript.
So i made a simple extension and included it in the setup of the page:
includeLibs.kdg_popup = EXT:kdg_popup/pi1/class.tx_kdgpopup_pi1.php
class.tx_kdgpopup_pi1.php has following content:
<?php
require_once(PATH_tslib.'class.tslib_pibase.php');
class tx_kdgpopup_pi1 extends tslib_pibase {
var $prefixId = 'tx_kdgpopup_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_kdgpopup_pi1.php'; // Path to
this script relative to the extension dir.
var $extKey = 'kdg_popup'; // The extension key.
var $pi_checkCHash = TRUE;
function main($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
//$this->pi_loadLL();
// parse XML data into php array
$this->pi_initPIflexForm();
// get the values
$img = $this->pi_getFFvalue($this->cObj->data['pi_flexform'],
'field_img', 'sDEF');
$img_zoom =
$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'field_img_zoom',
'sDEF');
$strlink = 'img: $img, img_zoom: img_zoom';
return $this->pi_wrapInBaseClass($strlink);
}
}
?>
datastructure of FCE looks like this:
<field_img type="array">
<tx_templavoila type="array">
<title>Bild (Standard)</title>
<eType>image</eType>
<TypoScript>
<![CDATA[
10 = TEXT
10.userFunc = tx_kdgpopup_pi1->main
]]>
</TypoScript>
</tx_templavoila>
<TCEforms type="array">
...
</TCEforms>
</field_img>
<field_img_zoom type="array">
<tx_templavoila type="array">
<title>Bild (Zoom)</title>
<eType>image</eType>
</tx_templavoila>
<TCEforms type="array">
...
</TCEforms>
</field_img_zoom>
But i can't get the values of the fields img and img_zoom. What's going
wrong?
Please help:
Henry
More information about the TYPO3-english
mailing list