1

Concept is to stash entry_ids of playa entries to pass to jquery-nivoslider call, so that both the slider div and the call will not have identical slider ID's resulting with conflict.

{exp:stash:set_list 
name="rehab_list" 
parse_tags="yes" 
trim="yes" 
parse_depth="4"
}

   {exp:channel:entries 
   channel="rehab" 
   url_title="{segment_3}" 
   limit="1"
   require_entry="yes"
    }

    {stash:rehab_entry_id}{entry_id}{/stash:rehab_entry_id}
    {stash:rehab_url_title}{url_title}{/stash:rehab_url_title}
    {stash:rehab_title}{title}{/stash:rehab_title}

{stash:playa_stash_test}test{/stash:playa_stash_test}

   {exp:stash:set_list:nested   
name="rehab_update_list"      
trim="yes"
parse_tags="yes" 
parse_depth="3"   
} 

    {exp:playa:parents 
    channel="rehab_update" 

    limit="10"}

          {stash:playa_test}test22{/stash:playa_test}
               0{stash:playa_entry}|{entry_id}{/stash:playa_entry}
                {stash:playa_title|{title}{/stash:playa_title}

                {image_uploads sort="asc"}{photo_images size="thumbnail"}     
                {stash:playa_entry_img}{photo:url}{/stash:playa_entry_img}
                {stash:playa_entry_img_label}photo_label}   {/stash:playa_entry_img_label}
        {/photo_images} {/image_uploads}

   {stash:playa_summary_update}{summary_update}{/stash:playa_summary_update}
   {stash:playa_materials_needed}{materials_needed}{/stash:playa_materials_needed}
   {stash:playa_steps_taken}{steps_taken}{/stash:playa_steps_taken}

    {/exp:playa:parents}
     {/exp:stash:set_list:nested}
  {/exp:channel:entries}
  {/exp:stash:set_list}
8
  • And what is {stash:update_ids} giving you? Commented May 12, 2014 at 22:35
  • What if u use {exp:stash:update_ids} or exp:stash:get name='update_ids' instead ? Commented May 13, 2014 at 2:26
  • Got it outputting. Thanks! Next question is where do I apply the var I created to keep in sync the loop in the header labeling - '#slider-{entry-id}'?
    – Matt
    Commented May 13, 2014 at 2:46
  • Can u edit your post with solution ? Commented May 13, 2014 at 3:29
  • I can't get it to parse through my nested list which has my parent playa loop
    – Matt
    Commented May 17, 2014 at 15:54

3 Answers 3

2

Set your var like this, using the trim parameter to remove whitespace and line breaks from the captured variable:

{exp:channel:entries channel="rehab" url_title="{segment_3}" limit="1" require_entry="yes"}
    {exp:stash:set name="update_ids" parse_tags="yes" trim="yes"}
        0{exp:playa:parents channel="rehab_updates" status="open" limit="10"}|{entry_id}{/exp:playa:parents}
    {/exp:stash:set}
{/exp:channel:entries}

Using the captured variable

Use the process="end" parameter to delay the parsing of the wrapped code block until the end of template parsing (i.e. after the variable has been set). Inside {exp:stash:parse} tag pairs, stash variables can be accessed as placeholders in the form {stash:my_var}, which saves you having to use parse="inward" when passing a tag as a parameter.

{exp:stash:parse process="end"}
    {exp:channel:entries channel="rehab"}
      {exp:playa:parents channel="rehab_updates" status="open" entry_id="{stash:update_ids}"}
        <script type="text/javascript">
          $(window).load(function() {
            $('#slider-{entry-id}').nivoSlider({});
          });
        </script>
      {/exp:playa:parents}
    {/exp:channel:entries}
{/exp:stash:parse}


{exp:stash:parse process="end"}
    {exp:playa:parents channel="rehab_updates" status="open" limits="10" entry_id="{stash:update_ids}"}
{/exp:stash:parse}
4
  • I'm having an issue with my playa loop where it doesn't parse the playa vars and displays them with the playa prefix. This is using the process end to display my playa loop in my entry
    – Matt
    Commented May 14, 2014 at 22:57
  • You may need to try setting parse_depth="x" on the {exp:stash:parse} where x is a number greater than 1. Commented May 15, 2014 at 16:35
  • If you reduce the code you are now using to the minimum to reproduce the problem, and update your question with it, I will try to help further. Commented May 15, 2014 at 16:36
  • I reduced down the previous thought and have added a new thought line that i'd like to see which would be better and most likely to succeed at
    – Matt
    Commented May 17, 2014 at 6:16
1

Snippets parse first, so your Stash tag {exp:stash:update_ids} gets read directly as it's written without being parse when that snippet code gets parsed. You can test that by only putting {exp:stash:update_ids} in your snippet.

Possible solution: Move that snippet code either into a Stash embed or regular EE embed.

Also, the limit parameter is just limit="10" not limits="10".

0

This is also possible and less complicated if you use sort="entry_id" orderby="asc" it would in essence accomplish what the idea was

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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