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.

Relationship Field in Conditional?

May 28, 2013 1:47pm

Subscribe [2]
  • #1 / May 28, 2013 1:47pm

    thejame

    24 posts

    I had code that was working perfectly until I upgraded to 2.6.x - now my conditional statement is not working.
    Before, this worked in 2.5.5:

    {exp:channel:entries channel="sliders" orderby="slider_order" sort="asc"}
      {if slider_event_link}
        {related_entries id="slider_event_link"}<a href="http://{path=">{/related_entries}_  {if:elseif slider_page_link}<a href="{slider_page_link}">{/if}_  {slider_image}_  {if slider_event_link OR slider_page_link}</a>{/if}
    {/exp:channel:entries}

    Upon upgrade I now have this, which I understand but is not recognizing my IF statement.  This runs but only outputs the Image tags - I’ve checked the relationship field and made sure it’s populated:

    {exp:channel:entries channel="sliders" orderby="slider_order" sort="asc"}
      {if slider_event_link}
        {slider_event_link}<a href="http://{path=">{/slider_event_link}_  {if:elseif slider_page_link}<a href="{slider_page_link}">{/if}_  {slider_image}_  {if slider_event_link OR slider_page_link}</a>{/if}
    {/exp:channel:entries}

    Is there a better way to do what I’m doing?  I need the condition - I only want to show the link on the image if there if there is a value in the other field.

    Also, I noticed that some code was stripped out and this forum won’t let me copy it into this textarea field - see the screenshot for what I really have in my template.
    Thanks.

  • #2 / May 28, 2013 2:49pm

    thejame

    24 posts

    I just noticed that I have 2 different fieldtypes in my Add-On section of EE.
    “Relationship” version 1.0 is shown by not installed / activated.
    “Relationships” version 1.0 is shown and installed / activated.

    Is one of these obsolete? Should they both be in use?  What’s the difference?

    Edit: per this blog post (http://ellislab.com/blog/entry/relationships-evolved-for-expressionengine-2.6) I’m not worrying about the fieldtypes - it looks like all my current relationships were updated without any issues but my problem still persists - the data is there but I can’t get to it with a conditional.

  • #3 / May 29, 2013 2:26pm

    jphansen80

    20 posts

    I just noticed that I have 2 different fieldtypes in my Add-On section of EE.
    “Relationship” version 1.0 is shown by not installed / activated.
    “Relationships” version 1.0 is shown and installed / activated.

    Is one of these obsolete? Should they both be in use?  What’s the difference?

    Edit: per this blog post (http://ellislab.com/blog/entry/relationships-evolved-for-expressionengine-2.6) I’m not worrying about the fieldtypes - it looks like all my current relationships were updated without any issues but my problem still persists - the data is there but I can’t get to it with a conditional.

    Hi thejame,

    I had the same thing, where “Relationship” and “Relationships” both existed in my Add-Ons > Fieldtypes. This happened because the folder system/expressionengine/fieldtypes/rel existed, which was carried over from my previous EE install. That folder looks like it’s no longer needed unless you have fields referencing the old “Relationship” field, and is the source for “Relationship” being there. It was actually causing PHP undefined variable notices while installed, so I uninstalled it then deleted that folder, now it’s gone completely.

    Relationships seem to be consolidated into the “Relationships” fieldtype.

    I’m looking for relationships conditionals in a channel:entries loop, as well.

  • #4 / May 30, 2013 2:12pm

    thejame

    24 posts

    Thanks, that confirms that we both have a problem.  There is definitely something going on with Relationships and how they show up under other channels.

    I did find this thread and will try the suggestion:
    http://ellislab.com/forums/viewthread/235638/

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

ExpressionEngine News!

#eecms, #events, #releases