I am customising a Joomla module (Override) and it does not seem to accommodate if an image is not selected (just shows a broken image symbol).
What I'd like to do is check if there is an image and if not, assign a placeholder image.
<div class="sp-portfolio-thumb">
<a href="<?php echo $item->link; ?>"><img src="<?php echo $item->image; ?>" alt="<?php echo $item->title; ?>" /></a>
<div class="sp-portfolio-overlay">
<div>
<!--<a class="sp-portfolio-preview" rel="lightbox" title="<?php echo $item->title; ?>" href="<?php echo $item->image_full; ?>"><?php echo JText::_('PREVIEW'); ?></a>-->
<?php if($show_readmore){ ?>
<a class="sp-portfolio-link" href="<?php echo $item->urls->urla; ?>"><?php echo JText::_('MORE_DETAILS'); ?></a>
<?php } ?>
</div>
</div>
</div>
I've tried playing about with the part of the code relating to the image, but I'm clearly not very proficient in php.
<?php if ($item->image){ ?>
<a href="<?php echo $item->link; ?>"><img src="<?php echo $item->image; ?>" alt="<?php echo $item->title; ?>" /></a>
<?php else ?>
<img class="test" src="images/placeholder.jpg">
<?php } ?>
I'm getting:
0 - syntax error, unexpected 'else' (T_ELSE)
Can any one point me in the right direction with this?