I have a complex question.
I have 3 channels 1. members (zoo visitor) 2. Events 3. Institutions
An institution has a relationship to members (field is trainers) Events have a relationship to Institutions
a) When I post an event I want to display the Institution information.
b) Then also include the members (trainers) info
a) is working fine but I cant get the related field to members to display.
{exp:channel:entries channel="events" sort="asc" orderby"title" limit="1" disable="member_data" show_future_entries="yes" show_expired="no" dynamic="on" url_title="{segment_3}"}
<h1 class="content-title">{title}</h1>
<span>Organization:</span>
{institution}
{institution:title}
</div>
<div class="trainer-email">
<span>Email:</span>
{institution:institution_email}
</div>
<div class="trainer-email">
<span>City:</span>
{institution:institution_city}
</div>
<div class="trainer-email">
<span>Street:</span>
{institution:institution_street}
</div>
<div class="trainer-biography">
<span>Web:</span>
{institution:institution_web}
</div>
<div class="trainer-biography">
<span>Desc:</span>
{institution:institution_description}
</div>
<!-- show trainers info -->
{parents channel="members" field="trainers"}
<div class="show">
<strong>{parents:title}</strong>
<div class="what">{parents:trainer_city}</div>
<div class="when">{parents:trainer_state}</div>
</div>
{/parents}
{/institution}
{/exp:channel:entries}
ref: AMI
So the problem is you need to specify you’re looking for parents of the institution:
<!-- show trainers info -->
{institution:parents channel="members" field="trainers"}
<div class="show">
<strong>{institution:parents:title}</strong>
<div class="what">{institution:parents:trainer_city}</div>
<div class="when">{institution:parents:trainer_state}</div>
</div>
{/institution:parents}
I am a still a little confused to what field I need to reference here: field=”trainers”
Where field should I reference here?
Channel “events” field: institution (relationship, multi, with channel “training_institutions” )
Channel “training_institutions” Field: trainers (relationship, multi to members)
Channel: “members” Field: title, member_first_name, member_last_name
Severity: Warning
Message: array_merge() expects at least 1 parameter, 0 given
Filename: relationship_parser/Tree_builder.php
Line Number: 133
The field should specify the field name of the relationship that you want parents for. For instance, if your setup looked like this:
Then, this would be what gets you to that level:
{exp:channel:entries channel="events"}
{institution}
{institution:parents field="trainers"}
{institution:parents:title}
{/institution:parents}
{/institution}
{/exp:channel:entries}
oddly getting this error using your code above on a blank empty template.
ee. ver 2.10.1
A PHP Error was encountered
Severity: Warning
Message: array_merge() expects at least 1 parameter, 0 given
Filename: relationship_parser/Tree_builder.php
Line Number: 133
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/user/admin/codeigniter/system/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 479
Updated to EE2.11. this code is a little different than the original. (different template) I got the institutions to display properly on the events template.
Still cannot get my relationship to my members channel to display anything
Channel: channel=”training_institutions”
Field: directors (multi relationship field, related to the members channel)
Field: trainers(multi relationship field, related to the members channel)
Field: assistants (multi relationship field, related to the members channel)
Channel: channel=”members”
Field: member_first_name, member_last_name
{exp:channel:entries channel="training_institutions" sort="asc" orderby"title" limit="1" disable="member_data" show_future_entries="yes" show_expired="no" dynamic="on" url_title="{segment_3}"}
{title}
{categories} {category_name} {/categories}
<div class="trainer-biography">
<span>Directors:</span>
{directors}{directors:title}{directors:member_first_name} {directors:member_last_name}{/directors}
</div>
<div class="trainer-biography">
<span>Trainers:</span>
{trainers}{trainers:title} {trainers:member_first_name} {trainers:member_last_name}{/trainers}
</div>
<div class="trainer-biography">
<span>Assistants:</span>
{assistants}{assistants:title} {assistants:member_first_name} {assistants:member_last_name}{/assistants}
</div>
{/exp:channel:entries}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.