I have a question for the best way to display multiple fluid fields.

  • channel: {houses}
  • fluid field: {occupant}
  • fluid sub-field: {name}
  • fluid sub-field: {phone}

When I only try and display the names, it displays just fine:

    {exp:channel:entries channel="houses" status="open"}

But I cannot figure out who to display each person's phone...

Thoughts anyone?


1 Answer 1


Each entry in the fluid field stores the content of whatever fields are defined for that entry from the set of fields assigned to the fluid field. So for each entry in your channel you might have a different set of fields defined - unlike regular fields in EE, what fields appear within a fluid field for an entry are defined when the entry is created rather than being determined by the assignment of fields to the channel.

So the only way to show the content of fluid fields is for the template to loop through the fields defined for a fluid field in an entry and on each pass through try to display what is found. So you need to put into the template code to display every possible field - the fluid field will then display the content on your page, in the order that the fluid field components have been chosen for that entry.

As a result, the template code you need display a fluid field will look a bit like this...

      <html and ee template code for subfield_1>
      </html and ee template code for subfield_1>
      <html and ee template code for subfield_2>
      </html and ee template code for subfield_2>
      <html and ee template code for subfield_3>
      </html and ee template code for subfield_3>
... etc

Each loop will fire one of the subfield entries, and the number of loops for an entry will equal the number of subfields defined for that entry.

For your case, one thing to be mindful of is that if you put phone number in as a possible fluid field, there is a chance that for some entries the value will not be defined (as it relies upon the phone field being selected when the entry is created) - if you are sure that all entries will have a phone number (i.e. "display each person's phone number" in your question) it might be better to use a regular field for the phone number rather than put it in the set available to a fluid field...

Hope that makes sense... :)

  • It makes sense, but I was hoping to associated a specific number with a specific name, like this: {exp:channel:entries channel="houses" status="open"} {title} <ul> <li>{occupant}{occupant:name}{content}{/occupant:name}{/occupant} - {occupant:phone}{content}{/occupant:phone}<li> </ul> {/exp:channel:entries} May 24, 2018 at 21:47
  • Ok, that looks like poop. Basically, how can I list each occupant and their specific phone number together. Each "house" will have multiple occupants. Each occupants has two pieces of information that are linked: Their name, and their phone number. They should be related. If I just cycle through a list of names, then separately, cycle through a list if phone number, they won't makes sense who is what... Does that makes sense? May 24, 2018 at 21:50
  • Hi Jake. As I noted in answer, if you know that there will be specific information about each entry in a channel, don't use fluid fields to store it - just create regular fields in the channel and use those. Then as you cycle through the list of entries in the channel you can display the phone and name information for each at the same time, and be sure that they will match up! Fluid fields are great in some circumstances, and a great innovation in EE4, but sometimes you just don't need the extra complexity! HTH May 25, 2018 at 23:11
  • Thanks for clarifying that. Easy when you get your head round it ;-)
    – Adam Rifat
    Nov 27, 2018 at 20:55

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.