Re: [rasbro] IF image THEN ...
Hi Brian,
Do you have a mockup html page that shows the effect or design you're going for? That might help us get there quicker.
>What do I put if I don't want to include the text for each
>image. So for example, I only want this line, <br />
><span>Click to view larger image</span>to be added once.
If you only want to print one image, you can break out for a foreach loop (and stop looping over additional images) with the break function, like this: <?php break; ?> Just put that after the text you want displayed.
>I am trying to display a "Sorry, No Image" image when there
>is not an image uploaded to represent the product. Here is
>what I have ... It doesn't work the way I have it currently.
Try replacing this line:
<?php foreach (getUploads($options['tableName'], 'thumbnail_image', $record['num']) as $upload): ?>
With these lines:
<?php $uploads = getUploads($options['tableName'], 'thumbnail_image', $record['num']); ?>
<?php foreach ($uploads as $upload): ?>
Then you'll be able to test if there was any images _after_ your foreach loop like this:
<?php $uploads = getUploads($options['tableName'], 'thumbnail_image', $record['num']); ?>
<?php foreach ($uploads as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="75" height="75" alt="inset photo" />
<?php endif ?>
<?php endforeach ?>
<?php if (count($images) == 0): ?>
<img src="/images/NoImage-thumbnail2.jpg" width="75" height="75" alt="inset photo" />
<?php endif ?>
Let me know it goes!
Dave Edis - Senior Developer
interactivetools.com