Hi,
ich habe soeben eine eigene extension geschrieben. Es werden Produkte im Backend angelegt und diese werden erfolgreich im FE ausgegeben. Nun hab ich dazu ne Frage: Ich hole mir die Daten aus der DB und wenn das Feld x leer ist soll er es nicht darstellen. (zum Verständniss bitte template angucken.)
$query = 'SELECT name,text,picture, spezifikationen FROM `tx_txproducts_items`';
$query .= ' WHERE deleted = 0 AND hidden = 0 AND pid = "'. $pageId .'" ';
$res = mysql(TYPO3_db, $query);
while($row = mysql_fetch_assoc($res)) {
if($row['picture'] == "") { $row['picture'] = "spacer.jpg"; }
foreach ($row as $key => $value) {
$marker["###". strtoupper($key) ."###"] = $value;
}
if(!empty($row['spezifikationen'])) {
$marker["###SUB_SPEZI####"] = array();
}
$content .= $this->cObj->substituteMarkerArrayCached($tmpl, $marker);
}
return $content;
<!-- ###PRODUCTS### start -->
<table width="100%" cellspacing="0" cellpadding="0">
<tr valign="top">
<td rowspan="2" width="135px"><img width="120px" src="uploads/tx_txproducts/###PICTURE###" alt="###NAME###" title="###NAME###" /></td>
<td><strong>###NAME###</strong><br />
###TEXT###</td>
</tr>
<tr>
<td>
<!-- ###SUB_SPEZI#### start--><a href="index.php?id=###SPEZIFIKATIONEN###">Spezifikation</a> <!-- ###SUB_SPEZI#### end-->
</td>
</tr>
</table>
<hr />
<br />
<!-- ###PRODUCTS### end -->
ich selbst habe nicht viel ahnung von typo3, daher kenn ich nicht Komandos. Bei smarty würde mir sofort einfallen
{if $spezifikation} {$spezifikation} {/if}
Und somit ist das gelöst, aber bei typo3 kein Plan 🙂
Was ich noch gelesen hab das man was mit subparts machen kann, aber in dem Fall weiß ich nciht ganz wie ich das hinbekommen soll.
Vielen Dank für die Mühe ...
MfG
stefan
// sollte ich mich missverständlich ausgedrückt haben, sagt es und ich überarbeite das ganze noch einmal.