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.

Reverse related entries not showing field content

July 10, 2011 7:20pm

Subscribe [2]
  • #1 / Jul 10, 2011 7:20pm

    Wolfram

    115 posts

    Hello,
    I am having difficulties displaying/using the contents of a reverse-related entries field. 

    This is the set up:
    - I have a first channel called “magazines”, that has different entries for every issue of a magazine.
    - A second channel “magazine images” contains sample spreads of the different magazine issues. Each image is a separate entry in this channel with a relationship to the channel “magazines”. In the relationship field (“issues”) I select the appropriate issue for every image.

    When I try to display the images as reverse-related entries inside the “magazines” channel, I run into a problem: While the images are shown for the right magazine issue, the content of “issue” (example: “july 2011”) is not shown, but instead an ID-number for every image.
    Can the contents of the field establishing the relationship not be displayed? I am trying to use the contents to build “issue galleries” with fancybox. Here´s my basic code:

    {exp:channel:entries channel="magazines" sort="asc"}
    {title}
    
    {reverse_related_entries channel="magazineImages"}
    <a href="http://{image}%22class=%22grouped_elements" rel="{issue}" class="grouped_elements">_{exp:imgsizer:size src="{image}" width="150" height=""}_{sized}_{/exp:imgsizer:size}_</a>
    {issue}
    {/reverse_related_entries}
    
    {/exp:channel:entries}

    Thanks for any suggestions!

    Wolfram

  • #2 / Jul 11, 2011 1:25pm

    Sue Crocker

    26054 posts

    Hi, Wolfram. What kind of field type is issue?

  • #3 / Jul 11, 2011 5:09pm

    Wolfram

    115 posts

    Hi Sue,
    the “issue” field type is “relationship”. In the meantime I had a look in phpmyadmin: The numbers that are displayed seem to be the rel_id´s of the exp_relationships table or so. I was expecting the actual text strings that I choose in the pop-up of the relationship field when I publish an entry, say “March 2011”, “July 2011” (= the titles of the “magazine” channel entries). What can I do to retrieve these strings inside the reverse_related entries tags?

    Basically, I want to show the pictures together with the info in which issue they belong. Or, in other words, I want to display the title of the relationship-entry inside the reverse_related entries tags. It does not make too much sense to actually display this of course, but I would need this text string for the “rel”-parameter of fancybox (in order to build a little slide show of all images belonging to a given issue.)

    I am sorry as this all sounds rather complicated, I hope you have an easy solution 😊

    Wolfram

  • #4 / Jul 12, 2011 8:46pm

    Lisa Wess

    20502 posts

    Hi, Wolfram,

    I see you’re using ImageSizer. We’ve seen a lot of reports of problems with that add-on, and it seems many are moving to CE Images.

    Because of that, can I get you to test without that plugin in play?  So:

    {exp:channel:entries channel="magazines" sort="asc"}
    {title}
    
    {reverse_related_entries channel="magazineImages"}
    {issue}, {image}
    
    {/reverse_related_entries}
    
    {/exp:channel:entries}

    Does your content show up as expected in that reduced example?

  • #5 / Jul 13, 2011 7:34pm

    Wolfram

    115 posts

    Hello Lisa,

    thanks for the heads-up concerning imagesizer but in this case it does not make any difference.

    The contents of {image} is displaying as expected, but the contents of {issue} is giving me back numbers from the exp_relationships table   which seem to be the rel-id´s (see screenshot of your reduced code), while I was hoping to see the actual text strings that I choose from in the relationship field.

    Since the options of the pop-up menu of the relationship field {issue} in the magazineImages channel are the {title}´s in the magazine channel, I was hoping for the text of the titles so I could use these in the “rel” parameter of fancybox to define a little slideshow per magazine issue.

    If there is no other way I guess I could define a category group for magazineImages and assign a issue-category to every image and use that for the “rel” parameter. But this seems like doing the same thin twice?

    Suggestions very welcome!

    Wolfram

  • #6 / Jul 14, 2011 11:05pm

    Lisa Wess

    20502 posts

    Hi, Wolfram -

    Yes, the relationship ID is what is stored in the relationship custom field type, as the ID is what is stored.  If you need something else, you might use another custom field for it, and then pull that in, instead.

    Alternatively, Playa may store that information differently and may be an option for you. I’m not sure if that would help you in this situation.

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

ExpressionEngine News!

#eecms, #events, #releases