Hide image if <$imagesrc$> is empty in a the repeater

Is there a way to check if the image src is empty and adapt the design in this case?

For example, I want to be able to display a list with 2 cols if the image is existing and only one column if the image is not existing.

roshodgekiss roshodgekiss, 5 years ago

Hi mrdoinel, welcome to the forums! You can try creating a fluid layout using two table cells, then delete the repeater content in one of the cells when you want to switch to a 1 column layout. Here's a sample table:

<table width="600" border="0" align="center" cellpadding="5" cellspacing="0">
    <td colspan="2"><img src="http://placekitten.com/590/300" width="590" height="300" alt="Kitten" /></td>
    <td width="1%"><repeater><img src="<$imagesrc link='true' default='http://placekitten.com/150/150' width="150" $>" /><h2><$title link='true' default='Col 1' $></h2><$description default='<p>Col 1 content</p>' $></repeater></td>
    <td width="99%"><repeater><h2><$title link='true' default='Col 2' $></h2><$description default='<p>Col 2 content</p>' $></repeater></td>

As you can see, I've set the width of the cells as 1/99% respectively. The repeater image is used for width control. Not the perfect solution, but as close as we're going to get (for now!)

Get in touch with us on Twitter: http://twitter.com/campaignmonitor
We're also on Facebook: http://facebook.com/campaignmonitor

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free