Im parsing a file with thumbnails for each item, however some items have no thumbnail. If the data in that field is blank how can I display a default image?
Im using this code..
print "(h2)(a href='".$item["ITEM/LISTINGDETAILS/VIEWITEMURL"]."')".$item["ITEM/TITLE"]."(/a)(/h2)";
print "(img src='".$item["ITEM/VENDORHOSTEDPICTURE/GALLERYURL"]."' /)";
print "(br /)(br /)";
Thanks
Hi!
This should just be a case of testing the thumbnail (which I assume is the GALLERYURL item) for an empty string, and conditionally displaying the default image if it is empty. The following code should do the trick:
print "<h2><a href='".$item["ITEM/LISTINGDETAILS/VIEWITEMURL"]."'>".$item["ITEM/TITLE"]."</a></h2>";
if ($item["ITEM/VENDORHOSTEDPICTURE/GALLERYURL"])
{
print "<img src='".$item["ITEM/VENDORHOSTEDPICTURE/GALLERYURL"]."' />";
}
else
{
print "<img src='default.gif' />";
}
print "<br /><br />";
Hope this helps!
David.