ExpressionEngine 7.5 has been Released! Learn More!
I have a channel called {calendar_events} in which there are several fields, including {short_title}, {additional_comments} and a relationship field called {program}
See attached.
In my template if I write:
{calendar:short_title}
The short_title is displayed correctly.
The same is true if I write:
{calendar:additional_comments}
But if I write:
{calendar:program}
Nothing displays. I would expect it to display the title of whichever program is selected in the relationship field.
How can I get that title to display?
This is great! I’m closer than I’ve ever been before. Thank you for your help so far!
With that said, the limit=”1” solution is always returning the first entry in the calendar_events channel. The program selected in the relationships channel won’t always be the first entry.
Any tricks up your sleeve to make it respect the selection made in the relationships field and return the title associated with that selection?
edit* - I’m looking at it a bit closer, and it turns out it’s not bringing up the first Program in the channel. It’s always bringing up our “Family Engagement” program, which doesn’t have the lowest ID#, and is not the first alphabetically. I have no idea why it’s selecting Family Engagement as the 1 entry to display. But regardless, it’s not respecting the selection made in the relationship field.
edit2* - It’s looping through the calendar_events channel…not the programs channel. And it’s bringing up the title of the program selected in the newest calendar_event entry for all entries.
The code example lists entries from your calendar_events channel that relates to a Program.
If you wanted to list all Programs (or just one) you’d call that channel, for example if your Programs channel has a short name of “programs” and the relationship field of “program”:
{exp:channel:entries channel="programs" limit="1"}
<!-- Program title-->
{title}
<!-- calendar_events that relate to this program -->
{parents field="program"}
{parents:title}
{/parents}
{/exp:channel:entries}
Thanks you for all your help. I just found out this isn’t going to work. This gem was found deep within the calendar add-on documentation:
“For performance reasons (due to the recurrence rule functionality where we have to “inflate” event results in the template tags), Calendar uses its own rewritten version of the Channel:Entries functionality. The trade-off here is that more advanced fields like Grid, File, Relationship, etc will not work or have limited functionality:
Currently the Relationship fieldtype will not parse inside any Calendar template tags. We hope to restore some functionality for this in the future.”
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.