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.

Related_entries call prints output??

August 12, 2010 10:07am

Subscribe [6]
  • #1 / Aug 12, 2010 10:07am

    UntitledStudio

    29 posts

    I have the following code:

    {exp:channel:entries channel="channel1" category="{segment_3}" dynamic="no" style="linear"}
        {related_entries id="channel2"}
        {/related_entries}
    {/exp:channel:entries}

    For some reason this is printing the output

    {REL[267][channel2]VvIzefHrREL}

    If i remove the related_entries calls:

    {exp:channel:entries channel="channel1" category="{segment_3}" dynamic="no" style="linear"}
    {/exp:channel:entries}

    Nothing is printed to the screen as you’d expect.

    What’s going on here? Am I doing something wrong? EE2.1, no custom modules except imgsizer which doesn’t touch the DB.

  • #2 / Aug 12, 2010 3:25pm

    Green Egg Media

    111 posts

    The id parameter for {related_entries} should be the short_name of the field that contains the relationship. It looks like you are trying to identify a channel, not a field.

    Also, this is not a reverse_related_entries call; rather, a standard related_entries usage. If you want to use Reverse Related Entries, you need to use the {reverse_related_entries} tag pair, and there is no need to specify an id.

    Lance
    Green Egg Media

  • #3 / Aug 12, 2010 4:10pm

    Ingmar

    29245 posts

    Thanks for the assist. Doest that help, UntitledStudio?

  • #4 / Aug 12, 2010 9:40pm

    UntitledStudio

    29 posts

    Thanks for your reply Green Egg Media.

    My mistake, my code is actually:

    {exp:channel:entries channel="channel1" category="{segment_3}" dynamic="no" style="linear"}
        {related_entries id="field_name"}
        {/related_entries}
    {/exp:channel:entries}

    I incorrectly typed it above - I’m using fake channel and field names. Anyway - the channel name and field name in related_entries call are both correct. Removing the related_entries call results in the weird text being printed to the screen disappearing.

    With regards to the post title - is a moderator able to fix that? It should be ‘related_entries’ not ‘reverse_related_entries’

  • #5 / Aug 13, 2010 6:19pm

    Brandon Jones

    5500 posts

    UntitledStudio,

    Is this code by itself in a template? Inside the related_entries tag pair you also need to specify the field of the related entry you’d like to show, such as {title}.

  • #6 / Aug 15, 2010 7:40am

    UntitledStudio

    29 posts

    I changed it so the entire contents of the template is this:

    {exp:channel:entries channel="channel1" category="{segment_3}" dynamic="no" style="linear"}
        {related_entries id="field_name"}hihi{/related_entries}
    {/exp:channel:entries}

    This results in the following being printed to the screen:

    {REL[267][gi_entrance]qbYFUStyREL} hihi hihi hihi

    I removed the related_entries line and

    Changing to

    {exp:channel:entries channel="channel1" category="{segment_3}" dynamic="no" style="linear"}
        {related_entries id="field_name"}{title}{/related_entries}
    {/exp:channel:entries}

    Results in:

    {REL[267][gi_entrance]QqHQcbGyREL} Item1 Item2

    Changing to:

    {exp:channel:entries channel="channel1" category="{segment_3}" dynamic="no" style="linear"}
    yoyo
    {/exp:channel:entries}

    Results in:

    yoyo yoyo yoyo yoyo

    Changin to:

    {exp:channel:entries channel="channel1" category="{segment_3}" dynamic="no" style="linear"}
    {title}
    {/exp:channel:entries}

    Results in:

    Title1 TItle2 Title3 Title4

    Now that I’ve done all these tests and confirmed what I’ve already stated above, how can I fix this issue? There’s clearly something wrong with either my DB or EE itself. What can I do to fix it.

  • #7 / Aug 15, 2010 4:35pm

    Greg Salt

    3988 posts

    Hi UntitledStudio,

    Please try resaving one of the entries that is related to your channel1 entries. Does that entry then display properly?

    Cheers

    Greg

  • #8 / Aug 15, 2010 10:20pm

    UntitledStudio

    29 posts

    This issue has been fixed. I had to resave one of the channel1 entries. The relation field must have broken somewhere along the line for that entry.

  • #9 / Aug 16, 2010 6:16am

    John Henry Donovan

    12339 posts

    May have been a cache issue. Re-saving the entry cleared it. All relationships are kept in cache. So if it happens again try clearing the cache first. Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases