ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

using relationships in entries

July 16, 2012 12:26am

Subscribe [2]
  • #1 / Jul 16, 2012 12:26am

    Bethany Creative

    16 posts

    I’m a little confused on the relationship field type.

    I have a channel setup, and one of the channel fields is an “author” this field is set as a relationship to another channel of the authors. However it’s rather difficult when listing the main channel to filter it and show the entries for a particular author. My current method is a convoluted reverse entry method using another embed file, and it ends up breaking pagination.

    is there a simple way to do this?

    Thanks,

    Jamie

  • #2 / Jul 17, 2012 12:39pm

    Kevin Smith

    4784 posts

    Hi Jamie,

    I hear ya, relationships between entries can be confusing to try to wrap your brain around. I think what you’re looking for is reverse related entries. What you essentially want to do is show the one entry for your author and then list all the entries that use that author as their relationship field, right? So using the doc’s example as the basis for an example here, the template code for this might look like:

    {exp:channel:entries channel="authors" limit="1"}
            <h2>{title}</h2>
    <p>        {author_bio}</p>
    
    <p>        {reverse_related_entries sort="desc" orderby="title"}<br />
                    </p><h3>{title}</h3>
    <p>                {body}<br />
            {/reverse_related_entries}<br />
    {/exp:channel:entries}

    Then the author is that is display by the main channel entries tag is determined based on information in the URL. Does that all make sense?

  • #3 / Jul 17, 2012 3:27pm

    Bethany Creative

    16 posts

    Ya i’ve tried that and it works, but the functionality you loose is kind of a deal breaker. Pagination being a major part of it.

     

  • #4 / Jul 18, 2012 12:59pm

    Kevin Smith

    4784 posts

    Yep, unfortunately, reverse related entries does have a limited feature set compared to a full channel entries tag.

    Have you checked into using something with a bit more robust functionality like Playa?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases