Skip to content

Instantly share code, notes, and snippets.

@electricputty
Created October 15, 2012 13:44
Show Gist options
  • Save electricputty/3892531 to your computer and use it in GitHub Desktop.
Save electricputty/3892531 to your computer and use it in GitHub Desktop.
My set tag:
{exp:stash:set parse_tags="yes" parse_depth="2"}
{exp:channel:entries channel="project" category="{segment_2_category_id}" disable="member_data|pagination" dynamic="no" orderby="random"}
{exp:stash:append_list name="proj_list"}
{stash:proj_title}{title}{/stash:proj_title}
{stash:proj_url}{url_title}{/stash:proj_url}
{stash:proj_cat}{exp:gwcode_categories entry_id='{entry_id}' style='linear' limit='1'}{cat_url_title}{/exp:gwcode_categories}{/stash:proj_cat}
{stash:proj_img}{cf_project_feature limit="1"}{cf_project_feature_img}{/cf_project_feature}{/stash:proj_img}
{stash:proj_size}{exp:low_random:number from="2" to="4"}{/stash:proj_size}
{/exp:stash:append_list}
{/exp:channel:entries}
{/exp:stash:set}
I need the low random output to be parsed at this point, so that I get a number 2/3/4 when I use the :get_list command, as Switchee is having problems using that tag as a variable to test (understandably).
Is there a method to do this?
@croxton
Copy link

croxton commented Oct 15, 2012

{exp:stash:set_list name="proj_list" parse_tags="yes" parse_depth="2"}
    {exp:channel:entries channel="project" category="{segment_2_category_id}" disable="member_data|pagination" dynamic="no" orderby="random"}
        {stash:proj_title}{title}{/stash:proj_title}
        {stash:proj_url}{url_title}{/stash:proj_url}
        {stash:proj_cat}{exp:gwcode_categories entry_id='{entry_id}' style='linear' limit='1'}{cat_url_title}{/exp:gwcode_categories}{/stash:proj_cat}          
        {stash:proj_img}{cf_project_feature limit="1"}{cf_project_feature_img}{/cf_project_feature}{/stash:proj_img}
        {stash:proj_size}{exp:low_random:number from="2" to="4" random}{/stash:proj_size}
    {/exp:channel:entries}
{/exp:stash:set_list}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment