[SOLVED]Alternative content for empty content_image value
Posted: Mon Sep 14, 2009 4:10 pm
Hi
I'm having problems with my syntax working how I want.
I have a content_image block in my CMS that is used for an option image to be placed on pages. When the image is not selected within the CMS from the content_image drop-down menu (ie. it is set to "---none---") I don't want the image, or accompanying HTML, to be displayed at all.
I have written a condition that seems to do this, but when I save and submit a page that has no image set, the loop still executes and I am left with an image that has a src of ="-1"
Can anyone spot what I am doing wrong with my code below?
{content_image block='Caption Image' dir='images' urlonly='true' assign='caption_var'}
{if !empty($caption_var)}
{content block='Caption Text' wysiwyg="false" oneline="true"}
{else}
{/else}
{/if}
You can see it in action on this page
I'm having problems with my syntax working how I want.
I have a content_image block in my CMS that is used for an option image to be placed on pages. When the image is not selected within the CMS from the content_image drop-down menu (ie. it is set to "---none---") I don't want the image, or accompanying HTML, to be displayed at all.
I have written a condition that seems to do this, but when I save and submit a page that has no image set, the loop still executes and I am left with an image that has a src of ="-1"
Can anyone spot what I am doing wrong with my code below?
{content_image block='Caption Image' dir='images' urlonly='true' assign='caption_var'}
{if !empty($caption_var)}
{content block='Caption Text' wysiwyg="false" oneline="true"}
{else}
{/else}
{/if}
You can see it in action on this page