0

Ok so I am using a Stash embed / view model approach.

I have a custom filed Playa with specific articles for a product. I also have a Low Variable storing a playa of related articles for a category.

I am using this in a Stash embed.

In my model I am trying to set the data so:



    {!-- RELATED ARTICLES --}
    {exp:stash:set_list name="related_articles" debug="yes" parse_tags="yes"}

        {cf_paper_specific_articles}   
            {stash:url_title}{url_title}{/stash:url_title}
            {stash:test_title}P {title}{/stash:test_title}
            {stash:abstract}{cf_article_short_abstract}{/stash:abstract}           
        {/cf_paper_specific_articles}

        {exp:low_variables:pair var="lv_articles_inkjet_paper" var_prefix="category_articles"}
            {stash:url_title}{category_articles:url_title}{/stash:url_title}
            {stash:test_title}C {category_articles:title}{/stash:test_title}
            {stash:abstract}{category_articles:cf_article_short_abstract}{/stash:abstract} 
        {/exp:low_variables:pair}

    {/exp:stash:set_list}


The top part works ok and I get my product specific articles as expected. But the bottom section, parsing the playa in the low variable, does not get parsed, resulting in output like:

P A Simple, Accurate Print Viewing System Using Grafilite Lights    Set up an inexpensive colour accurate print viewing area using Grafilite lights.
C {category_articles:title} {category_articles:cf_article_short_abstract}

Before moving to Stash embeds, I had this working succesfully like this:


       

Related Articles

{cf_paper_specific_articles} {title}{cf_article_short_abstract} {/cf_paper_specific_articles} {exp:low_variables:parse var="lv_articles_inkjet_paper" var_prefix="category_articles"} C- {category_articles:title}{category_articles:cf_article_short_abstract} {/exp:low_variables:parse} {exp:playa:children field='cf_paper_brand' var_prefix="brand" } {exp:low_variables:parse var="lv_articles_{brand:url_title}" var_prefix="brand_articles"} ##### B- {brand_articles:title}{brand_articles:cf_article_short_abstract} {/exp:low_variables:parse} {/exp:playa:children}

(there's an extra bit there that works too...but I want to get the more basic case working first!)

I have tried various parse="inward" type things...but no dice. The nested nature of stash->low vars->playa is doing my head in and I am hoping smarter brains than me can see why this doesn't work!!

  • 1
    You have an orphaned {/exp:playa:children} in your code above - is it meant to be there? – Mark Croxton Jul 8 '13 at 12:51
  • Just a cut and paste error here on SE - I've removed it above and it's definitely not in the actual code. – Jeremy Daalder Jul 8 '13 at 22:42
  • Guessing this is more a Stash thing than a Low Variables thing. Just letting you know I saw this, but can't help you out from a LV perspective, as that seems to work OK. – Low Jul 9 '13 at 7:22
  • Thanks @Low - yes the LV code is working in the straight template but not in the stash scenario :( – Jeremy Daalder Jul 9 '13 at 11:05
  • @MarkCroxton Any further ideas with this one? – Jeremy Daalder Jul 10 '13 at 1:48
1

I would guess that the Low Variables tag pair returns a formatted Playa tag pair to the template, rather than actually parsing the Playa tag itself.

Your {exp:stash:set_list} has parse_tags="yes" set which by default will parse one "shell" of tags inside it (just the outer shell). The first Playa tag pair cf_paper_specific_articles will have already been "parsed" once (actually, just replaced with a Playa tag pair) by the outer channel entries tag, and so Stash will parse that one without issue. The second Low Vars tag pair will then be parsed by stash, but as it just exposes another shell (the Playa tag) you need Stash to make a second pass with it's parser or it will just try to capture the un-parsed Playa tag.

TL;DR: add parse_depth="2" to the {exp:stash:set_list} tag.

| improve this answer | |
  • Ok - had tried parse depth on the outer exp:stash:parse that wraps all this (to depth 10!) - but no dice. Should have worked out that works more locally! Thankyou so much - that's just awesome. – Jeremy Daalder Jul 10 '13 at 10:44
  • Correct, each stash tag that does parsing creates it's own instance of the parser. That's the 'trick' that allows Stash to recursively parse itself ;). – Mark Croxton Jul 10 '13 at 17:35

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.