Displaying a Default Image
6 posts by 4 authors in: Forums > CMS Builder
Last Post: June 14, 2017 (RSS)
By mark99 - June 9, 2017
Is there any easy way to show a default image for a product in my database, without having to upload one manually to each and every product?
At present the product's that have an image show the image via a simple bit of code (see below) and then obviously nothing shows if no image has been uploaded. But instead of nothing I'd quite like to show a place-holder default, just not sure how to do it.
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo $isp_listRecord['title'] ?> Logo Image" />
By Twocans - June 9, 2017
Hi yea,
I think this could be right,
<?php if(htmlencode($record['urlPath']) === NULL ) : ?>
your image here
<?php else: ?>
your dafault image here
<?php endif ?>
https://www.interactivetools.com/forum/forum-posts.php?postNum=2200421#post2200421
cheers
k
By Damon - June 13, 2017
Hi Mark,
Try adding this code outside of the image foreach loop:
<?php if (!$record['uploads']) : ?>
Add code for default image here.
<?php endif ?>
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By AlanAlonso - June 13, 2017
I will use this with my catalog project, I will use CMSB for a online store.