0

I'm having trouble getting var_prefix to work with the exp:playa:parents tag.

Here's my code:

                        {exp:channel:entries 
                        channel="skills"
                        orderby="title"
                        sort="asc"
                        category="65"
                        parse="inward"
                        disable="member_data|pagination|category_fields"
                    }
                        <p>{title}</p>
                        {exp:playa:parents 
                            channel="skills" 
                            entry_id="{entry_id}"
                            var_prefix="pre"
                        }
                        {if pre:total_results > 1}
                            {if pre:count == 1}
                            <a data-toggle="modal" data-target="#content-{entry_id}"><span class="glyphicon glyphicon-info-sign"></span></a>
                            {/if}
                        {/if}
                        {/exp:playa:parents}

                    {/exp:channel:entries}

I'm trying to achieve two things:

  1. I would like to get the total_results and count variables for the results from the playa tag and not the parent exp:channel:entries tag.

  2. I would like to get the exp:channel:entries {entry_id} inserted in this line data-target="#content-{entry_id}" rather than the {entry_id} from the exp:playa:parent entry.

Any help would be appreciated.

2

Try removing the parse="inward" parameter from your {exp:channel:entries} tag. It may be confusing things and you don't really need it anyway.

3
  • Hi kgrote, I tried removing the parse parameter but that wasn't the problem. I realized that I am able to get a value for pre:count but the problem is I can't use it in a conditional. Is this a limitation of the using var_prefix or a bug? – KoalaKid May 30 '14 at 23:10
  • Try writing it this way: {if '{pre:count}' == '1'}. – kmgdev May 30 '14 at 23:33
  • That did the trick, thanks your a life saver. – KoalaKid May 31 '14 at 21:43

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.