I am trying to use stash to kill multiple queries to the same channel in multiple places in the site/page. This is my stash embed file called 'featured.html':
{exp:channel:entries channel="homepage_featured_items" dynamic="no" show_expired_entries="yes" orderby="date" category='40|41|42|162' disable="member_data|category_fields|pagination"}
{exp:stash:append_list name='featured_list'}
{stash:this_category}{categories}{category_id}{/categories}{/stash:this_category}
{stash:article}
<article class="col_4 col left">
<header>
<h4><a href="{featured_item_link}">{featured_short_text}</a></h4>
</header>
<div class='article-content'>
<p><a href="{featured_item_link}">{featured_short_description}</a></p>
</div>
{exp:ce_img:pair src="{featured_image_home}" width="220" height="150" crop="yes|center,top|0,0"}
<img src="{made}" alt="{title}" width="{width}" height="{height}" />
{/exp:ce_img:pair}
</article>
{/stash:article}
{/exp:stash:append_list}
{/exp:channel:entries}
And I would like to bring different categories in like so:
<div id="featured_home">
{exp:stash:embed:featured}
{!-- 40,41,42,162 --}
{exp:stash:get_list name="featured_list" match="#^.*40.*$#" against="this_category" limit="1"}
{article}
{/exp:stash:get_list}
</div>
But for some reason I am getting nothing. I put output='yes' on my stash embed append_list tag and I got all of the information I am looking for (albeit more articles than I wanted), but I can't call the context or the category. Ideally I would like to call these all over the page(s) of the site:
{exp:stash:get_list name="featured_list" match="#^.40.$#" against="this_category" limit="1"} {exp:stash:get_list name="featured_list" match="#^.41.$#" against="this_category" limit="1"} {exp:stash:get_list name="featured_list" match="#^.42.$#" against="this_category" limit="1"} {exp:stash:get_list name="featured_list" match="#^.162.$#" against="this_category" limit="1"}
Also, am I saving anything but multiple calls in this instance? Should I be looking for a context in this case?