Related entries: parents, childen ... what about siblings?
Posted: 27 November 2006 07:14 AM   [ Ignore ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15365
Joined  05-15-2004

I am using (reverse) related entries extenisvely on a site I am currently building. Works very well. And while I can easily link from “parent” entries to their “children”, and vice versa, I would like to link from one related article to others that are equally related: its siblings, for want of a better analogy.

Anybody tried anything like this?

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 27 November 2006 08:15 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

So, please correct me if im wrong, you want to show all entries related to the parent of the entry you are looking at?  If i’m on the right track may i ask do the children have multiple parents?

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 27 November 2006 08:53 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15365
Joined  05-15-2004

Yes. I have one parent, multiple childern. When I view the parent, linking to the children is easy. Also, when viewing a child, linking back to the parent, no problem. What I want is a link to that child’s parent’s other children, ie siblings.

Of course, I could follow the link to the parent and then to any child I want. Children only have one parent, in my case at least.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 27 November 2006 09:14 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

In that case Ingmar you could try doing the following.  I understand this may not work - but it’s just an idea :D

{exp:weblog:entries weblog="{my_weblog}" url_title="{segment_3}"}

<h1>{title}</h1>
{body}

Siblings
:

{reverse_related_entries}
  {exp
:weblog:entries entry_id="{entry_id}"}
    
<ul>
    
{related_entries id="my_field_name"}
      
<li>{title}</li>
    
{/related_entries}
    
</ul>
  
{/exp:weblog:entries}
{
/reverse_related_entries}

{
/exp:weblog:entries}

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 27 November 2006 09:17 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15365
Joined  05-15-2004

I think I actually tried that. Perhaps not the exact code, but I had experimented with nesting related and reverse related entries. Well, I’ll give it a try anyway. This is by no means a must-have feature, you understand, and if push came to shove I suppose I could always query the database directly.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 27 November 2006 09:26 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

I think it would make a perfectly reasonable FR. Infact - i can think of a site i’m working on right now that would benefit.

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 27 November 2006 09:40 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15365
Joined  05-15-2004

So do I.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64905 Total Logged-in Users: 55
Total Topics: 81838 Total Anonymous Users: 31
Total Replies: 440014 Total Guests: 255
Total Posts: 521852    
Members ( View Memberlist )