We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Table of Contents with Relationships-Module and Parents/Siblings

How Do I?

Stefan Rechsteiner's avatar
Stefan Rechsteiner
442 posts
8 years ago
Stefan Rechsteiner's avatar Stefan Rechsteiner

My Goal: I have a «Topics»-Channel where every entry is a topic (like «Fruits») with multiple related entries (like «Apple», «Banana», «Peach»…) via the native Relationships-Module. On the entry-template where I display the «Apple»-entry, I want a list of all the related entry via the parent «Fruit». Like a «Table of Content» of «Fruits» with all fruits AND the current fruit (Apple) somehow highlighted.

My Problem: If I list all related entries with…

{parents channel='topics'}
  <ol>{siblings channel='detail' field='topics-related'}
    <li>{siblings:title}</li>{/siblings}
  </ol>
{/parents}

… i only get a list of all OTHER entries, but without the current one … e.g. «Apple» in this case — I want the full list, and in the correct order.

Any Ideas?

Before switching to the native Relationships-Module, i used Playa and there I had this feature. Is it just not possible with «Relationships»? If so: who want’s to participate in a FR? 😉

       
Derek Jones's avatar
Derek Jones
7,561 posts
8 years ago
Derek Jones's avatar Derek Jones

From discussion in Slack, since you are looking of all children of a given parent, and not the siblings for the current entry, the rough pattern is to jump up to the parent and then just drill through all the related children as normal. Example:

{exp:channel:entries channel='player' limit='1'}
 <h1>{title}</h1>

 <h2>Full team</h2>

 {parents field='team_roster'}
  <ul>
   {parents:team_roster orderby='player_position' sort='asc'}
    <li>{parents:team_roster:title}: #{parents:team_roster:player_position}</li>
   {/parents:team_roster}
  </ul>
 {/parents}
{/exp:channel:entries}

Would output something like this, while viewing the single entry for Mayberry Round:

<h1>Mayberry Round</h1>

<h2>Full team</h2>


 <ul>
 
  <li>Frank Caliendo: #01</li>
 
  <li>Mayberry Round: #12</li>
 
  <li>Todd Foo: #26</li>
 
  <li>Joe Smith: #31</li>
 
  <li>John Doe: #53</li>
 
 </ul>
       
Stefan Rechsteiner's avatar
Stefan Rechsteiner
442 posts
8 years ago
Stefan Rechsteiner's avatar Stefan Rechsteiner

Perfect, that’s it! As easy as that. 😊 Thank you @derek.jones ! 😊

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.