We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Pulling relationship data from a fluid field (and that data is inside a grid)

How Do I?

Liam Crean's avatar
Liam Crean
121 posts
6 years ago
Liam Crean's avatar Liam Crean

So I have a fluid layout. The layout pulls needs to pull in relationship data from each block.

What’s the mark up for this?

{fluid_field}
{fluid_field:relationship_field}
{fluid_field:relationship_field:title}
{/fluid_field:relationship_field}
{/fluid_field}

?

And once I’ve got that working, then how do you pull in grid field data from the related entry?

Is it something like:

{fluid_field}
{fluid_field:relationship_field}
{fluid_field:relationship_field:grid_field}
{fluid_field:relationship_field:grid_field:title}
{/fluid_field:relationship_field:grid_field}
{/fluid_field:relationship_field}
{/fluid_field}

?

       
Liam Crean's avatar
Liam Crean
121 posts
6 years ago
Liam Crean's avatar Liam Crean

For reference - this appears to work:

{fluid_field}
{fluid_field:relationship_field}
{content}
    
     {content:title}

     {content:grid_field}
     {content:grid_field:grid_data}
     {/content:grid_field}
  
{/content}
{/fluid_field:relationship_field}
{/fluid_field}

Some documentation how to best use Grid / Relationship / Fluid together might be a good idea — the power they wield together is a good selling point. But the syntax is a spaghetti soup, and means a lot of trial and error.

For example you can create a fluid field, and have a grid block inside this, and inside the grid block have relationships. Which could be wonderful… But good luck figuring out that without docs… (I chose another more hacky route as I’m short of time)

       
webmaster_keith's avatar
webmaster_keith
3 posts
about 6 years ago
webmaster_keith's avatar webmaster_keith

Also couldn’t find my answer in the docs

I have a Fluid Field with a Grid Field in that with a Relationship field in that: This works:

{fluid_field}
     {fluid_field:grid_field}
          {content}
               {content:grid_relationship_field}{content:grid_relationship_field:title}{/content:grid_relationship_field}
          {/content}
     {/fluid_field:grid_field}
{/fluid_field}
       
Robin Sowell's avatar
Robin Sowell
13,158 posts
about 6 years ago
Robin Sowell's avatar Robin Sowell

Thanks for sharing. Looks like I need to add a couple of more complex relationships to the examples!

       
webmaster_keith's avatar
webmaster_keith
3 posts
about 6 years ago
webmaster_keith's avatar webmaster_keith

Apologies if I’ve missed it

also, not to give you more work on the examples, but should something like this work?:

{fluid_field}
          {fluid_field:grid_field}
           {content}
            {content:grid_relationship_field}
             {content:grid_relationship_field:relation_fluid_field}
              {content:grid_relationship_field:relation_fluid_field:relation_grid_field}
               {content:grid_relationship_field:relation_fluid_field:relation_grid_field:relation_grid_relation_field}
                {content:grid_relationship_field:relation_fluid_field:relation_grid_field:relation_grid_relation_field:url_title}
               {/content:grid_relationship_field:relation_fluid_field:relation_grid_field:relation_grid_relation_field}
              {/content:grid_relationship_field:relation_fluid_field:relation_grid_field}
             {/content:grid_relationship_field:relation_fluid_field}
            {/content:grid_relationship_field}
           {/content}
          {/fluid_field:grid_field}
         {/fluid_field}

I don’t get errors, but I don’t get anything else either.

I can’t think of a useful usecase for it though, was just interested if it would/should work?

       
xynergy_inc's avatar
xynergy_inc
10 posts
5 years ago
xynergy_inc's avatar xynergy_inc

Webmaster_Keith’s post is correct, but must have confused me when I first tried it because I couldn’t get it working.

This code works to output the relationship data if you have a Relationship Field inside a Grid Field that’s inside a Fluid Field:

{fluid_field}
 {fluid_field:grid_field}
  {content}
   {content:relationship_field}
    {content:relationship_field:title}
   {/content:relationship_field}
  {/content}
 {/fluid_field:grid_field}
{/fluid_field}

Robin, feel free to add to the docs - might save others a bunch of time!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.