With Stash you have always been able to create global variables and evaluate them in the same template using if/else conditionals:
{exp:stash:set_value name="var" value="cheese" type="snippet"}
{if var == "cheese"}
We have cheese!
{if:else}
Where's the cheese, gromit?
{/if}
This still works as it always has in ExpressionEngine 2.9. However, despite the new conditionals parser in 2.9 evaluating "when ready" this control structure will still result in all tags inside every condition being parsed (as it did previously in older versions of EE). Let's modify the conditional to illustrate the problem:
{exp:stash:set_value name="var" value="cheese" type="snippet"}
{if var == "monkey"}
{exp:stash:set_value name="test" value="monkey"}
{if:else}
{if var == "cheese"}
{exp:stash:set_value name="test" value="cheese"}
{if:else}
{exp:stash:set_value name="test" value="tennis"}
{/if}
{/if}
{!-- Expected output: cheese. Actual output: tennis --}
{exp:stash:test}
In this case the "test" variable is set three times, and so ends up with the value "tennis". This happens because conditionals are evaulated before and after tags are parsed in a given "layer" of the template, but NOT in-between tags.
How to solve this problem? We could use Switchee or IfElse, because, as tags, they evaluate after any preceding tags and before any following tags:
{exp:stash:set_value name="var" value="cheese" type="snippet"}
{exp:switchee variable="global:var" parse="inward"}
{case value="monkey"}
{exp:stash:set_value name="test" value="monkey"}
{/case}
{case default="yes"}
{switchee variable="global:var" parse="inward"}
{case value="cheese"}
{exp:stash:set_value name="test" value="cheese"}
{/case}
{case default="yes"}
{exp:stash:set_value name="test" value="tennis"}
{/case}
{/switchee}
{/case}
{/exp:switchee}
{!-- output: cheese --}
{exp:stash:test process="end"}
{exp:stash:set_value name="var" value="cheese" type="snippet"}
{exp:ifelse parse="inward"}
{if var == "monkey"}
{exp:stash:set_value name="test" value="monkey"}
{if:else}
{if var == "cheese"}
{exp:stash:set_value name="test" value="cheese"}
{if:else}
{exp:stash:set_value name="test" value="tennis"}
{/if}
{/if}
{/exp:ifelse}
{!-- output: cheese--}
{exp:stash:test process="end"}
Or, we can put the conditional inside a Stash parse block:
{exp:stash:set_value name="var" value="cheese" type="snippet"}
{exp:stash:parse}
{if var == "monkey"}
{exp:stash:set_value name="test" value="monkey"}
{if:else}
{if var == "cheese"}
{exp:stash:set_value name="test" value="cheese"}
{if:else}
{exp:stash:set_value name="test" value="tennis"}
{/if}
{/if}
{/exp:stash:parse}
{!-- output: cheese--}
{exp:stash:test}
Could you explain this bit some more? Specifically, which parts of your sample template are considered to be conditionals, tags, or layers?