1

Not sure if that title makes sense, but here is the problem I'm having.

I have a grid field with four rows (home-featured-lesson). This grid field has one column, which is a relationship(lesson-plan). You select the entry you want to relate, then I pull data from that.

It mostly works, apart from one bit - I have another grid field in the related entry (lesson-images) and I can't seem to pull anything from it. Here is my code:

{home-featured-lesson}
    <div class="lesson-plan">
        {home-featured-lesson:lesson-plan:lesson-images}
            <p>{home-featured-lesson:lesson-plan:lesson-images:image}</p>
        {/home-featured-lesson:lesson-plan:lesson-images}

        <h3>{home-featured-lesson:lesson-plan:title}</h3>
        <p>{home-featured-lesson:lesson-plan:lesson-summary}</p>
    </div>
{/home-featured-lesson}

And here is my output:

<div class="lesson-plan">


    <h3>Lesson Plan 1</h3>
    <p>Lorem ipsum</p>
</div>
<div class="lesson-plan">


    <h3>Lesson Plan 2</h3>
    <p>Lorem ipsum</p>
</div>
<div class="lesson-plan">


    <h3>Lesson Plan 3</h3>
    <p>Lorem ipsum</p>
</div>
<div class="lesson-plan">


    <h3>Lesson Plan 4</h3>
    <p>Lorem ipsum</p>
</div>

As you can see, the tag pair for the grid field inside the related entry is not returning anything at all. I've tried a few variations on the tag pair but nothing seems to work. Does anyone know where I'm going wrong here?

Thanks in advance!

2

I think you're almost there.

{home-featured-lesson:lesson-plan}
    {home-featured-lesson:lesson-plan:lesson-images}
        <p>{home-featured-lesson:lesson-plan:lesson-images:image}</p>
    {/home-featured-lesson:lesson-plan:lesson-images}
{/home-featured-lesson:lesson-plan}

I think you need to establish the first relationship, then the 2nd. Can't do it in one go, I believe.

  • Thanks for that! Works perfectly. Guess I'd been staring at it for too long to realise I was missing a loop :P – Joe Beaver Feb 27 '14 at 9:17

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.