I’m getting a couple strange errors with what should be a pretty simple conditional statement that tests the contents of a matrix field to trap an error when one of the fields is empty.
Here’s my template code:
{feature_images}
{if "{image_orient:label}" == "hidden"}
{if:else}
{feature_image}<!--Debug print the feature image URL-->
{image_orient:label}<!--Debug print image_orient:label value-->
{if feature_image != ""}
<ul class="{if "{image_orient:label}" == "horizontal"}horizontal{if:else}vertical{/if}">
<li><a href="http://{feature_image}" rel="lightbox" title="{exp:low_replace find=">" replace=""|<|>" multiple="yes"}{image_description}{/exp:low_replace}">{exp:imgsizer:size src="{feature_image}" width="{image_orient}" alt="{title}" title="{title}"}</a></li>
<li>{image_description}</li></ul>
{if:else}
<ul>
<li>{image_description}</li>
</ul>
{/if}
{/if}
{/feature_images}If {image_orient:label} is set to “hidden”, I want to bypass everything
If If {image_orient:label} is not “hidden”, I want to check if the {feature_image} field is empty and if so, bypass the image processing statements.
For some reason, I get imgsizer PHP errors, even when the test for “hidden” is true. Shouldn’t the section with the imgsizer tags be bypassed if the first condition is met?
Is this because the plugins are getting parsed before the conditional test?
Also, when I set the {image_orient:label} to a value that’s not “hidden”, in the debug output I see a period being output for {feature_image}.
Shouldn’t an empty Safecracker file field output nothing?
This should be simple but I’m perplexed. Any help much appreciated!
David