Hi Guys,
I having some difficulty working with related entries, i’m not sure I even have the channel entries set up perfectly but being my first EE website its all new to me!
I have two channels named ‘children’ and ‘rooms’. The children channel has a custom field (relationship) which link it to a specific room. It also has a custom field (third party fieldtype) which links it to a specific member account. This way I can display only children which belong to a specific member.
I have a dashboard which I need to display the children and rooms that are associated to the logged in member (parent), my issue arises when displaying the list of rooms that a parent has children in.
I use the {related_entries id=""} tag to get the rooms related to a child, but I cant then determine if a room has already been listed, it is possible a parent may have two children in the same room, and I don’t want to list that room more than once in the list of rooms associated to a parent.
I’m not sure if the solution is EE, PHP, or a entirely different approach, your thoughts would be really appreciated!!
<strong>My Children</strong>
<ul>
{exp:channel:entries status="Open" channel="children" dynamic="no"}
{if no_results}Whoops! No Children Entries Found{/if}
{if logged_in_member_id == "{child_parent get="member_id"}"}
{exp:imgsizer:size src="{child_image}" width="60" height="60"}
<li><a href="http://{title_permalink=%27parents/child%27}" title="{title}">{sized} {title}</a></li>
{/exp:imgsizer:size}
{/if}
{/exp:channel:entries}
</ul>
<strong>My Children's Rooms</strong>
<ul>
{exp:channel:entries status="Open" channel="children" dynamic="no"}
{if no_results}Whoops! No Children Entries Found{/if}
{if logged_in_member_id == "{child_parent get="member_id"}"}
{related_entries id="child_room"}
{exp:imgsizer:size src="{room_icon}" width="60" height="60"}
<li><a href="http://{title_permalink=%27parents/room%27}/about" title="{title}">{sized} {title}</a></li>
{/exp:imgsizer:size}
{/related_entries}
{/if}
{/exp:channel:entries}
Being quite new to EE i’m still learning the best practices for achieving things that I know how to do with PHP, I would really appreciate yor thoughts into this specific issue and any general feedback / resources you might have regards working with php within the EE templates.
Many thanks,
Sam