Hallo zusammen!
Ich schreibe gerade eine Extension und soweit läuft es, aber das Template macht mir Probleme.
So sieht es aus:
<!-- ###TEMPLATE_CATEGORY### -->
<!--- ###ITEMS### begin--->
<table border="1">
<tr>
<td>###MAINCATEGORY###</td>
<td>###SUBCATEGORY###</td>
</tr>
</table>
<!--- ###ITEMS### --->
<!-- ###TEMPLATE_CATEGORY### end -->
In meiner PHP Datei mache ich folgendes:
$template = $this->cObj->fileResource('EXT:ab/template/ab.html');
$t = array ();
$t['total'] = $this->cObj->getSubpart($template, "###TEMPLATE_CATEGORY###");
$t['item'] = $this->cObj->getSubpart($template, "###ITEMS###");
$subpartArray = array (
'###ITEMS###' => ''
);
$fieldmain = 'bezeichnung,uid';
$tablemain = 'ab AS a';
$wheremain = 'a.parent_category = 0';
// $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = true;
$resmain = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldmain,$tablemain,$wheremain);
// echo $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
while($rowmain = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resmain)) {
$markerArray['###MAINCATEGORY###'] = $rowmain['bezeichnung'];
$wheresub = 'a.parent_category='.$rowmain['uid'];
$ressub = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldmain,$tablemain,$wheresub);
if ($ressub){
$markerArray['###SUBCATEGORY###'] = '';
while($rowsub = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($ressub)){
$markerArray['###SUBCATEGORY###'] .= $rowsub['bezeichnung'];
}
}
$subpartArray['###ITEMS###'] = $this->cObj->substituteMarkerArray($t['item'], $markerArray);
$content .= $this->cObj->substituteMarkerArrayCached($t['total'], $markerArray, $subpartArray);
}
Das funktioniert, aber nicht so wie ich es will.
Anstatt einer Tabelle mit den Daten der Datenbank - bekomme ich für jede Maincategory eine Taballe. z.B.
<table>
<tr><td>maincategory1</td><td>subcategories 1 2 3 4</td></tr>
</table>
und dann:
<table>
<tr><td>maincategory2</td><td>subcategories 5 6 7 8</td></tr>
</table>
und ich möchte es so haben:
<table>
<tr><td>maincategory1</td><td>subcategories 1 2 3 4</td></tr>
<tr><td>maincategory2</td><td>subcategories 1 2 3 4</td></tr>
</table>
Ich habe es so mit anderen Extentions gemacht und es hat funktioniert, aber dies mal nicht mehr 🙁
Auf einem Tipp wäre ich sehr dankbar.