0

I have this code. Inside the stash tag pair, there is a loop that gets a list of author_ids based on certain conditions

{exp:stash:set name="author_ids" trim="yes" parse_tags="yes" parse_vars="yes"}
    ...
    {!-- TODO: Loop --}
    ...
{/exp:stash:set}

I outputted the code below for debugging purposes

<h2>exp:stash:author_ids - [{exp:stash:author_ids}]</h2>
<h2>{exp:stash:not_empty name="author_ids"}</h2>
<h2>{exp:stash:is_empty name="author_ids"}</h2>

The interesting thing is that this is the output for when I have a list of author_ids...

exp:stash:author_ids - [175|176|]
1
0

...and this is the output when there wasn't any author id that was set

exp:stash:author_ids - []
1
0

This is strange.

In both cases, why does the empty functions of stash return the same result for both cases when its apparent that in one case, the value is empty and the other is not empty?

1

I've tested this in the latest version of Stash on EE 2.8.1 and can't replicate your problem - it works fine for me.

Is there anything else in your template that could be causing it? Are you using the most up to date version?

  • The code above is before a code that embeds. The reason I want to do a conditional is that I want to pass certain embed variables based if a conditiona is true or not. I am using Stash 2.5.3. – arvinsim Jun 30 '14 at 22:30
  • 1
    ah right, you're using conditionals? In that case you'll need to use parse="yes" (which is a shortcut for parse_tags="yes" parse_conditionals="yes" parse_vars="yes") – James Smith Jul 1 '14 at 9:01

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.