4

I'm having Stash issues when using stash:variables within channel entry conditionals.

template.html

{stash:embed name="pages" stash:paginate="y"}

pages.html

{exp:channel:entries channel="page" dynamic="no" limit="{stash:limit}" disable="categories|category_fields|member_data"}
    <h2>{title}<h2>
    {if '{stash:paginate}' == 'y'}
        {!-- pagination code --}
    {/if}
{/exp:channel:entries}

Setting a limit using {stash:limit} works great, but I can't seem to show/hide pagination using stash:paginate="y". Pagination seems to always show regardless of the stash variable.

Aaron Bushnell
  • 281
  • 1
  • 6

2 Answers2

3

I expect it's a parse order thing, your first var is working because its parsed properly and your second var is not being parsed before the exp:channel.

Try parse=inward on your exp:channel

I'm no master with stash yet but similar experience suggests parse order is in play

Glenn Slaven
  • 33,720
  • 26
  • 113
  • 165
stuartmcd69
  • 255
  • 1
  • 6
  • parse="inward" has NO EFFECT on Module tags, which includes exp:channel:entries. parse="inward" only matters for plugins. So this won't accomplish anything. – adrienne Oct 26 '12 at 22:12
  • adrienne, that is not true. If you want to use a stash variable within a channel entries tag you have to use parse="inward" -- it won't work with out it – rkingon Nov 09 '12 at 18:38
3

I used stash for the first time recently and it does take some getting used to. I found I had to use the Parse="inward" tag and be mindful of using "value" vs 'value' (single quote vs double quote). Little things like that made all the difference. Bottom line...parse order is one of the most important aspects of EE, yet I and many others don't understand well enough. That is my homework for today: parse order and all it's minutia.

Doug
  • 539
  • 3
  • 12