2

I'd like to be able to use an if statement to determine what to show based on the amount of results from the if statement in a reverse related entry.

For example:

If an actor has two stage names, list the two stage names using the EE loop. But if the stage name fields in the entries match the actors name , show the 'No other stage names' text and not list the actors name again as I'm using it elsewhere on the page. I am trying the code below, but not working...

    {reverse_related_entries channel="play"}
                            {if stage_name != actor_name OR if stage_name !="" }
                            {stage_name}
                            {if count <1}
                            No other stage names
                            {/if}
                            {/if}
                        {/reverse_related_entries}

Any ideas??

Thx!

  • I don't think it can be done with the reverse_related_entries tag. Maybe try the Playa addon? THen you can use something like {exp:playa:children search:stage_name="=not {actor_name}"} – fccotech Jan 18 '13 at 13:17
2

Have you tried using the {if no_reverse_related_entries} conditional mentioned in the user guide? You also seem to have a typo in your conditionals.

Can you try this and see if it works

{reverse_related_entries channel="play"}
    {if stage_name != actor_name OR stage_name != ""}
        {stage_name}
    {/if}

    {if no_reverse_related_entries}
        No other stage names
    {/if}
{/reverse_related_entries}
| improve this answer | |
  • Hi Jerome,thanks for a quick reply. I tried that code, but the hang up is there are entries with no stage name, so the no other stage names doesn't get called. For example, I have 6 entries for an actor, and 3 of those entries have a stage name and the other 3 are blank. I want to show the the 3 stage names, and if no stage names different then the model name show the no results found tag – CJbrian Jan 18 '13 at 16:23
  • I'm sorry but I do not really understand what you are after here. You can use the {if no_reverse_related_entries} inside a lot of conditional combinations, whichever one suits your specific needs. – Jérôme Coupé Jan 18 '13 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.