ExpressionEngine 7.5 has been Released! Learn More!
Hi All. Anyone familiar with getting Field Groups within Fluid fields to work … ?
Have a field group defined within a fluid field - image shows it with some content in.
Have the following test template defined:
{section_page_content}
{section_page_content:fluid_main_text_element}
<div>Main Text Element:
{fields}
<div>Headline: {section_page_content:headline}{content}{/section_page_content:headline}</div>
<div>Lead Text: {section_page_content:lead_text}{content}{/section_page_content:lead_text}</div>
<div>Text Body: {section_page_content:text_body}{content}{/section_page_content:text_body}</div>
{/fields}
</div>
{/section_page_content:fluid_main_text_element}
{/section_page_content}
This appears to be consistent with the example given in docs … but when it generates output it gives peculiar results - with the fields block being repeated in full for each variable referenced… and with an extra blank set appended to the end. Clearly either I’m missing something obvious or there is something amiss…
Main Text Element:
Headline: Improving human performance
Lead Text:
Text Body:
Headline:
Lead Text: We believe that human performance can be improved through a programme of workshops, individual coaching and mentoring, and unqiue experiences that places you in new, challenging enviornments.
Text Body:
Headline:
Lead Text:
Text Body: No two individuals or teams are alike, and so our programmes are crated uniquely for your needs, founded on our knowledge and proven experience on what works to create positive change and growth. Each programme culminates in a challenging hpysical experience that takes you out of your usual workspace and empowers you to apply new skills into an unpredictable situation.
Headline:
Lead Text:
Text Body:
Anyone got any idea at all what is going on … and more usefully how I change this so that I get the three fields output in a single block… Thanks in advance for any thoughts / ideas / guidance.
Interested in learning more solutions or want to get to know other EE users? Read more about joining the slack here! Join Our Slack!
EE’s Bryan came through with the solution to this one.
If you change your {fields} block to this I think it will fix it
{fields}
{section_page_content:headline}<div>Headline: {content}</div>{/section_page_content:headline}
{section_page_content:lead_text}<div>Lead Text: {content}</div>{/section_page_content:lead_text}
{section_page_content:text_body}<div>Text Body: {content}</div>{/section_page_content:text_body}
{/fields}
The syntax is a little tricky but it mirrors the regular fluid field behavior where each “field pair” really gets translated into a conditional so it loops through and says {if field_name} content {/if} as it goes through each field individually.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.