0

I am sorry to ask this, but I am stuck here.

I must change (on two places) a css class if a channel entree exists. If yes, the class must be unit-70, if no, unit-90. This code below does not work, I do not know why. (when setting stash hardcoded it works as expected)

{exp:stash:set name="content_block_mid" parse_tags="yes" parse_conditionals="yes"}
  {exp:channel:entries
    channel="news_flash"
    disable="categories|category_fields|pagination|member_data"
    dynamic="no"
}
    {if no_results}unit-80{/if}
    {if count >= 1}unit-70{/if}
  {/exp:channel:entries}
{/exp:stash:set}

Can someone please point me in the right direction, obviously I am missing something here. I tried many options, but got lost because nothing works. This seems to me the simpliest of solutions, but I fail even here. Thank you!

1 Answer 1

0

Might try using 'unprefix' for the nested channel entry tags:

{exp:stash:set 
    name="content_block_mid" 
    parse_tags="yes" 
    parse_conditionals="yes"
    unprefix="my_prefix"
}
    {exp:channel:entries
        channel="news_flash"
        disable="categories|category_fields|pagination|member_data"
        dynamic="no"
    }
        {if my_prefix:no_results}unit-80{/if}
        {if my_prefix:count >= 1}unit-70{/if}
    {/exp:channel:entries}
{/exp:stash:set}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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