0

So I have a channel called Campaign, which has a number of ordinary text Input fields like 'campaign_twitter' and 'campaign_twitterhashtag'. It also has a Solspace Tag field called 'campaign_tag'.

This Channel helps to create a Campaign page, so that when you add a Solspace Tag, the page will then pulll in related content from the rest of the site, based on that Tag. What i'm having trouble with is getting that related content to display correctly. It is currently just displaying the custom field names on the page, so I'm assuming it's something to do with parse order or not setting up the stash correctly.

I was wondering if someone might be able to assist to get things displaying correctly?

So this is the list where I am setting all of the variables - Text Inputs and Solspace Tag;

{exp:stash:set_list name="campaign-vars" parse_tags="yes"}
    {exp:channel:entries
        channel="campaign"
        status="open"
        limit="1"
    }

        {stash:tag}{exp:tag:tags entry_id="{entry_id}" limit="1" websafe_separator="-"}{tag}{/exp:tag:tags}{/stash:tag}
        {stash:twitter}{campaign_twitter}{/stash:twitter}
        {stash:twitter_hashtag}{campaign_twitterhashtag}{/stash:twitter_hashtag}

        {stash:blog_entries}
            {exp:tag:entries
                channel="blog"
                status="open"
                orderby="title"
                sort="asc"
                tag="{tag}" {!-- This should be the tag retrived from {stash:tag} --}
            }
                {stash:blog_title}{title}{/stash:blog_title}
                {stash:blog_summary}{article_summary}{/stash:blog_summary}
            {/exp:tag:entries}
        {/stash:blog_entries}

    {/exp:channel:entries}
{/exp:stash:set_list}

This is where i'm displaying content in the page, notice the loop for the blog entries. Where the {blog_title} should be, it's showing the title of the current page and all other tags are just displaying the actual tag, with the exception of {twitter} tag, which is displaying correctly.

{exp:stash:set name="content"}

    {exp:stash:get_list name="campaign-vars"}

        {!-- Loop through blog entries here --}
        {blog_entries}
            {blog_title}
            {blog_summary}
        {/blog_entries}

        {!-- Display Twitter handle --}
        <p>Follow us on twitter: {twitter}</p>

    {/exp:stash:get_list}

{/exp:stash:set}
0

When you set your list you have two layers of nested tags to parse, so use parse_depth="2" to tell Stash to parse both layers. You are also trying to capture a nested list 'blog_entries', but are not using a supported syntax. Please see the docs for an example of setting / getting nested lists.

https://github.com/croxton/Stash

(Sorry can't link to exact line in docs because I'm typing this on my phone - see the set_list section)

0

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.