I have a channel field with no results

{if no_results} set variable here {/if}

I want to set a variable but use it further up the page

{if my_custom_var != "empty"} do some layout stuff here {/if}

1 Answer 1


If a variable is dependent on an entries loop, you definitely have to run that loop first to get the results. From there, it's up to you whether you set the variable with something like stash or raw PHP. A good PHP example is available on Stack Overflow. Just make sure you have your template's PHP Parsing Stage set to "Output".

Your Answer

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

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