0

Firstly let me say I'm probably making a really simple mistake, this is my first time using Stash so I'm trying to get my head around it. I've spent the last 45 minutes searching through Google and on here and can't find a solution.

The problem I'm having is I'm setting a stash_list which has Matrix tags inside of it, but when I'm using get_list I am getting the correct amount of rows returned, but they are empty.

Here is what my model view looks like: {!-- load stash view --} {stash:embed:layouts:standard}

{!-- create standard page model --}
{exp:channel:entries channel="standard_page" limit="1"}

    {!-- content (general) --}
    {exp:stash:set}
        {stash:title}{title}{/stash:title}
        {stash:introduction}{standard_introduction}{/stash:introduction}
        {stash:content}{standard_content}{/stash:content}

        {!-- helpers --}
        {stash:entry_id}{entry_id}{/stash:entry_id}
    {/exp:stash:set}

    {!-- content (lists) --}
    {exp:stash:set_list name="content_sections" parse_tags="yes"}
        {mx_standard_sections}
            {stash:section_title}{heading}{/stash:section_title}
            {stash:section_content}{content}{/stash:section_content}
        {/mx_standard_sections}
    {/exp:stash:set_list}

{/exp:channel:entries}

And here is what my view looks like:

<h1>{exp:stash:title}</h1>
<h2>{exp:stash:introduction}</h2>
<div class="content">
    {exp:stash:content}
</div> <!-- close content -->

<ul>
    {exp:stash:get_list name="content_sections"}
        <li>
            <h1>{exp:stash:section_title}</h1>
            {exp:stash:section_content}
        </li>
    {/exp:stash:get_list}
</ul>

My normal Stash fields work, however my get_list returns this:

<ul>
        <li>
            <h1></h1>

        </li>

        <li>
            <h1></h1>

        </li>
</ul>

So I'm not quite what's going on. Stash clearly knows there is two Matrix rows with data inside them, however it won't return the data at all. Thanks in advance for any help I get, and I apologise if it's a stupid mistake!

Thanks, Ben

1 Answer 1

0

When retrieving your list you're already in the context of that list so just change your called variable tags to the following:

<ul>
    {exp:stash:get_list name="content_sections"}
        <li>
            <h1>{section_title}</h1>
            {section_content}
        </li>
    {/exp:stash:get_list}
</ul>

You don't need the exp:stash prefix.

1
  • Wow, so it was something stupid! Didn't see that mention anywhere, thank you :)
    – Ben
    Commented Apr 30, 2013 at 22:53

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.