0

Basically i want to know if its possible for expression engines if tag to check if a wygwam field contains images.

I know its possible to pull through just images like so:

    {my_wygwam_field images_only="yes"}
      (code for images)
    {/wygwam_field}

but what if i want to check whether that tag returns any results. I tried

{if my_wygwam_field images_only="yes"}
    {my_wygwam_field images_only="yes"}
       (image code)
    {/wygwam_field}
{/if}

but it didn't seem to work. Any suggestions

2

You just need to vary your syntax slightly:

{if '{my_wygwam_field images_only="yes"}'}
    {my_wygwam_field images_only="yes"}
       (image code)
    {/wygwam_field}
{/if}

This way you're actually telling EE to parse that first tag (inside the conditional statement) - you need to do it this way because it's a tag pair requiring a parameter,so simple conditional checking won't work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.