0

Somehow, I'm not able to get this to work. I am populating 2 lists at the top of a template.

{exp:stash:set_list name="favorites" replace="yes" parse_tags="yes"}
{exp:favorites:entries}
  {stash:item_channel_name}{channel}{/stash:item_channel_name}
  {stash:item_title}{title}{/stash:item_title}
{/exp:favorites:entries}
{/exp:stash:set_list}


{exp:stash:set_list name="all_channels" replace="yes" parse_tags="yes"}
{exp:stash:get_list name="favorites"}
  {stash:c_name}{item_channel_name}{/stash:c_name}
{/exp:stash:get_list}
{/exp:stash:set_list}


{exp:stash:get_list name="all_channels" unique="yes"}
  {c_name}
  {exp:stash:get_list name="favorites" match="#^{c_name}$#" against="item_channel_name"}
  -{item_title}
  {/exp:stash:get_list}  
{/exp:stash:get_list}

I tried just using a static channel name in place of match="#Resources#" but it only outputs 1 item (the same item for each channel loop).

Here's the output thus far:

Channel Name: Benefits
Entry Title: 2015 Benefits Open Enrollment Information

Channel Name: Education
Entry Title: 2015 Benefits Open Enrollment Information

Channel Name: Forms
Entry Title: 2015 Benefits Open Enrollment Information

It's pretty much exactly like Mark's examples here https://gist.github.com/croxton/6219973 but I can't get it to work as intended. One thing though, when I manually limit the all_channels list to 1 item, it outputs the correct items from the favorites list (I tested it against 4 different channels, one at a time = all correct. If more than 1 item in the all_channels list, it does not work). To be certain it wasn't a server issue, I tried this on my local MAMP machine as well with the same results.

0

Try adding another word to your nested stash:get_list, a prefix parameter, and don't think you need parse='inward'. Something like:

{exp:stash:get_list 
    name="all_channels"
}
    Channel Name: {item_channel_name}--

    {exp:stash:get_list:nested 
        name="favorites" 
        match="#^{item_channel_name}$#" 
        against="item_channel"
        prefix="st_inner"
    }
        Entry Title: {st_inner:item_title}
    {/exp:stash:get_list:nested}

{/exp:stash:get_list}
1
  • no go still... I put up a revised scenario in the OP. I'm now populating the "all_channels" list from the same list as the favorites, so hopefully eliminate that plugin need. – jpea Oct 27 '14 at 18:21
0

Mark graciously pointed out that I was missing a nested tag in the get_list portion. I also added the channel_id in addition to the name so I didn't have to deal with needing to character escape names.

{stash:item_channel_id}{channel_id}{/stash:item_channel_id}

So, the get_list became this:

{exp:stash:get_list name="favorites" unique="item_channel_id" orderby="item_channel_name"}
#{item_channel_name}#
 {exp:stash:get_list:nested name="favorites" match="#^{item_channel_id}$#" against="item_channel_id" prefix="nested"  orderby="item_title"}
    {nested:item_title}
 {/exp:stash:get_list:nested}  
{/exp:stash:get_list}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.