I'd like to use a stash'd variable to filter a list of categories, but the following is not working:
{if segment_2=="thing1"}
{exp:stash:set name="cat_id"}22{/exp:stash:set}
{if:elseif segment_2=="thing2"}
{exp:stash:set name="cat_id"}23{/exp:stash:set}
{/if}
{exp:stash:set_list name="filters" parse_tags="yes"}
{exp:channel:categories channel="channel1" category_group="{exp:stash:get name='cat_id'}" backspace="6"}
{stash:category_id}{category_id}{/stash:category_id}
{stash:category_name}{category_name}{/stash:category_name}
{stash:category_url_title}{category_url_title}{/stash:category_url_title}
{/exp:channel:categories}
{/exp:stash:set_list}
I think this is a parsing issue, but how do I fix it?
Update: I tried this after the answer offered below:
{exp:switchee variable="{segment_2}" parse="inward"}
{case value="thing1"}
{exp:stash:set name="cat_id"}22{/exp:stash:set}
{/case}
{case value="thing2"}
{exp:stash:set name="cat_id"}23{/exp:stash:set}
{/case}
{/exp:switchee}
{exp:stash:set_list name="filters" parse_tags="yes"}
{exp:channel:categories channel="channel1" category_group="{exp:stash:get name='cat_id'}" backspace="6" parse="inward"}
{stash:category_id}{category_id}{/stash:category_id}
{stash:category_name}{category_name}{/stash:category_name}
{stash:category_url_title}{category_url_title}{/stash:category_url_title}
{/exp:channel:categories}
{/exp:stash:set_list}
I also tried: {exp:stash:get name='cat_id' process='end' }
But still no luck.