0

I seem to have a problem with Playa + conditionals + snippets. I've emailed P&T since it may be an error in Playa.

I'm trying to accomplish a listings page where the information displayed depends on the membership package of each entry. If statements don't seem to work correctly, perhaps it's the parse order?

{exp:channel:entries channel="companies" dynamic="no"}

  {!-- this works --}
  {company_membership_package var_prefix="pkg"}
    {pkg:title}
  {/company_membership_package}

  {!-- this works --}
  {company_membership_package}
    {title}
  {/company_membership_package}

  {!-- this fails - nothing displayed --}
  {company_membership_package var_prefix="pkg"}
    {if {pkg:title} == "Premium"}
      {snp_company-listings_Premium}
    {if:elseif pkg:title == "Premium"}
      {snp_company-listings_Premium}
    {/if}
  {/company_membership_package}

  {!-- this fails - outputs {snp_company-listings_Premium} --}
  {exp:playa:children var_prefix="pkg"}
      {snp_company-listings_{pkg:title}}
   {/exp:playa:children}

{/exp:channel:entries}

{company_membership_package} is a Playa field.

Thanks,
Paul

2

did you check if your if statements are matched? something like

{company_membership_package var_prefix="pkg"}
    {if '{pkg:title}' == 'Premium'}
      ppackage title is Premium
    {if:else}
      package title is not Premium
    {/if}
  {/company_membership_package}

By the way, maybe using single quotes as i did might help too

| improve this answer | |
  • Wow, can't believe it was as simple as surrounding the field-name by single quotes! – Paul Feb 4 '13 at 15:12

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.