Relationships Evolved for ExpressionEngine 2.6

It’s funny how relatively small things can make a big difference in what you can accomplish.  The ability to relate Channel Entries to each other seems like a small thing, but it can be very powerful.  For ExpressionEngine 2.6, we returned to the Relationships fieldtype to increase that power exponentially.

The first thing we needed to add was multiple relationships.  Which, of course, means a new Publish interface and a new Settings page.

Relationships Evolved

We also needed to come up with a new tag syntax.  Sam and I, EllisLab’s two newest members, took on the challenge.  Free of any assumptions, we sat down and brainstormed our dream tag syntax. Then we all set about making it a reality. To show it off, let me set up a quick example.

Say you were tasked with making a website for a music venue.  The venue frequently hosts a number of local bands.  The members of said bands often perform in more than one band or have solo side projects. 

You start by building three channels: Shows, Bands, and Musicians.  You give the Shows channel a Relationships field that points to Bands, naming it “Acts” with the short name “acts”.  You give the Bands channel a field that points to the Musicians channel, naming it “Members” with the short name “members”.

To list upcoming shows with the new tag syntax looks something like this:

{exp:channel:entries channel="shows" show_future_entries="yes"}
<div class="show">
    <
h2>{title}</h2>
    
With performances by:
    
{acts}
        
<div class="band">
            <
h3>{acts:title}</h3>
            <
p>{acts:description}</p>
            <
div class="members">
                
{acts:members}
                    
<p>{acts:members:name}</p>
                
{/acts:members}
            
</div>
        </
div>
    
{/acts}
</div>
{/exp:channel:entries} 

       
This will list all upcoming shows, the Bands that are playing and the Musicians of each band.  No embeds required.

Thanks to the work of the ExpressionEngine Reactor team, Extension hooks will be in place right out of the gate.  Developers can begin including support for the fieldtype in their add-ons straight away.

The updater will convert any old Relationship fields to the new Relationships field. It will also replace any old {related_entries} or {reverse_related_entries} tags in your templates with their new equivalents.

 

.(JavaScript must be enabled to view this email address) or share your feedback on this entry with @ellislab on Twitter.