--- class.dynaflex.php.org 2006-11-27 13:20:32.000000000 +0100 +++ class.dynaflex.php 2006-11-27 13:13:09.580660024 +0100 @@ -53,7 +53,8 @@ // the page id of the content element var $cePid = 0; - + + var $ceFields=array(); // The flexform data (XML or Array) the class is currently working on var $flexData; @@ -127,9 +128,10 @@ } else { // last but not least the page id of the content element if ($this->ceUid != 0) { - $pidRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pid', $this->ceTable, 'uid='.$this->ceUid); + $pidRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->ceTable, 'uid='.$this->ceUid); if ($pidRes) { $pidRes = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($pidRes); + $this->ceFields = $pidRes; $this->cePid = $pidRes['pid']; } } @@ -275,8 +277,7 @@ foreach ($path as $pathPart) { $dataDest = &$dataDest[$pathPart]; } - } - + } $dataDest = $data; } @@ -754,7 +755,12 @@ // we got the configuration in the 'source_config' array // the values are: table, select, where $handling = $funcConf['source_config']; - $handling['where'] = str_replace('###uid###', $this->ceUid, $handling['where']); + preg_match_all('/###(.[^#]*)###/i', $handling['where'], $whereMarker); + for ($index = 0; $index < count($whereMarker[0]); $index++) { + $handling['where'] = str_replace($whereMarker[0][$index], + $this->ceFields[$whereMarker[1][$index]], + $handling['where']); + } $dbData = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $handling['select'], $handling['table'], @@ -872,7 +878,7 @@ $fConf['label'] = $this->getLabel($fConf['label'], array('###DATA###' => $fieldData, '###FINDEX###' => $labelIndex)); preg_match_all('/###(.[^#]*)###/i', $fConf['name'], $nameMarker); preg_match_all('/###(.[^#]*)###/i', $fConf['label'], $labelMarker); - + preg_match_all('/###(.[^#]*)###/i', $fConf['config']['foreign_table_where'], $ftwMarker); // set some basics $aConfig['name'] = $fConf['name']; $aConfig['label'] = $fConf['label']; @@ -899,6 +905,9 @@ for ($index = 0; $index < count($labelMarker[0]); $index++) { $aConfig['label'] = str_replace($labelMarker[0][$index], $fieldData[$labelMarker[1][$index]], $aConfig['label']); } + for ($index = 0; $index < count($ftwMarker[0]); $index++) { + $aConfig['config']['foreign_table_where'] = str_replace($ftwMarker[0][$index], $fieldData[$ftwMarker[1][$index]], $aConfig['config']['foreign_table_where']); + } } if (!$aConfig) continue;