I have been fighting with the following code and variants, but have not been able to come up with anything that works. The idea is that I detect if the variable $largeimg6 (the URL of an image) is empty or not (whether an image has been loaded) and if not, load the value of a default variable ($defaultimage) which holds the URL of a default image..
<?php if(!empty($largeimg6)) : ?>
<img class="rpPicture" id="rpPicture<?php echo $key; ?>" onload="showPicture(this, <?php echo SHOW_PICTURES; ?>)" width="60" height="60" src="<?php echo $largeimg6; ?>" alt="Buy CD!" title="Buy CD!" />
<?php endif; ?>
The problem is that I do not know where to add the arguement for $largeimg6 being empty and therefore adding:
$largeimg6 = $defaultimage
Any help would be appreciated.
Thanks.
$largeimg6initially set? Will isset (php.net/manual/en/function.isset.php) work for you?if (isset($myvar)&&strlen($myvar)>0)