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.

Help with relating entries...

July 29, 2007 2:00pm

Subscribe [2]
  • #1 / Jul 29, 2007 2:00pm

    metaphase

    4 posts

    I am having problems using the related entries functionality

    I have 3 weblogs with custom fields:

    DJs - (using post title as DJ name)
    Venues - (using post title as venue name)
    Events - Using 2 custom fields, both relationship fields using the above 2 weblogs

    In my template I have the following code:

    {exp:weblog:entries weblog="events" limit="5" }
    See {djplaying} at {Venue} on {entry_date format="%D %F %d"}
    {/exp:weblog:entries}

    The result I get is this:

    See 4 at 3 on Mon December 31

    Where it SHOULD be something like

    See DJ Dan at Ministry of Sound on Mon December 31

    I cant work out why I am getting numbers instead of the actual proper data from these fields.

    Thanks

  • #2 / Jul 30, 2007 10:24am

    Robin Sowell

    13255 posts

    Skim over the docs on displaying related entry information again.  You need to use your related custom fields a bit differently:

    {exp:weblog:entries weblog="events" limit="5"}
    {related_entries id="djplaying"}
    DJs: {title}
    {/related_entries}
    
    {related_entries id="Venue"}
    Venues: {title}
    {/related_entries}
    
    {/exp:weblog:entries}

    It works a little differently than you’re trying to use it.  But does the basic logic of how to display related content make sense?

  • #3 / Jul 30, 2007 11:11am

    metaphase

    4 posts

    oh ok, so is it still possible to achieve the output that I need, i.e.  ?

    See DJ Dan at Ministry of Sound on Mon December 31

  • #4 / Jul 30, 2007 11:24am

    Robin Sowell

    13255 posts

    I think so, just not directly- venue and dj aren’t directly tied together- they’re independently tied to events.  So you can pull up the dj and you can pull up the venue.  Since there’s only one, I think if you structure it like:

    {exp:weblog:entries weblog="events" limit="5"}
    See {related_entries id="djplaying"}{title}{/related_entries}
    at {related_entries id="Venue"}{title}{/related_entries}
    on {entry_date format="%D %F %d"}
    {/exp:weblog:entries}

    Bit messy, but I don’t see why it shouldn’t work.

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

ExpressionEngine News!

#eecms, #events, #releases