Hallo,
Ich lese aus einer Datenbank Information aus und möchte sie in einer Tabelle ausgeben. Jeweils 5 Einträge nebeneinander, dann die nächsten 5 in der nächsten Zeile, bis alle Informationen ausgegeben sind. Wie sollte so ein Template in Typo3 üblicherweise aussehen? Wie handhabt man das am effizientesten?
Freue mich über jeden Hinweis
Sareen
Derzeit gebe ich alles in einer Zeile aus:
Code:
# Get the template
$this->templateCode = $this->cObj->fileResource($this->conf['templateFile']);
# Get the parts out of the template
$template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###');
$template['item'] = $this->cObj->getSubpart($template['total'],'###ITEM###');
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
# Build content from template
$markerArray['###MARKER1###'] = $row['username'];
$markerArray['###MARKER2###'] = $row['price'];
$content_item .= $this->cObj->substituteMarkerArrayCached($template['item'], $markerArray);
}
$subpartArray['###CONTENT###'] = $content_item;
$content = $this->cObj->substituteMarkerArrayCached($template['total'], array(), $subpartArray);
return $content; Code:
<h3>TEMPLATE</h3>
<em>This is a more complex html template</em>
<!-- ###TEMPLATE### begin -->
<table>
<!-- ###CONTENT### -->
<!-- ###ITEM### -->
<tr>
<td>###MARKER1###</td><td>###MARKER2###</td>
</tr>
<!-- ###ITEM### -->
<!-- ###CONTENT### -->
</table>
<!-- ###TEMPLATE### end -->