Guten Tag,
folgende Funktion holt sich aus einer mySQL DB Bilder und deren Beschreibungen und übergibt diese einer Smarty Template:
function returnGallery()
{
$this->db->select("pic.picture, pic.desc_".$this->language."",
"produktkuerzel AS pk, pictures_products AS pic, lnk_product_pic AS lpp",
"(pk.productname = '".$this->productName."')
AND(pk.id = lpp.id_product)
AND(lpp.id_picture = pic.id)",
"","","","");
$bilder = array();
while($row = $this->db->fetch_array())
{
$bilder['pic'][] = $row['picture'];
$bilder['thumb'][] = str_replace(".jpg", "-t.jpg", $row['picture']);
$bilder['txt'][] = $row[desc_.$this->language];
}
if(isset($bilder['pic'][0]))
{
return $bilder;
}
else
return false;
}
Smarty:
<div id="col3">
<!-- Gallery: Start-->
{if $bilder}
{section name=i loop=$bilder}
<p><a href="../images/shop/products/{$bilder.pic[i]}" target="_blank">
<img src="../images/shop/products/{$bilder.thumb[i]}" alt="" /></a><br />
{$bilder.txt[i]}
</p>
{/section}
{/if}
<!-- Gallery: End-->
</div>
Das Problem besteht darin, dass nur immer 3 Bilder mit Beschreibungen angzeigt werden, obwohl es für manche Produkte mehr gibt. Wo liegt das Problem. Sehe es einfach nicht.
Vielen Dank