0

I have a playa field into an entrie for a channel written by teachers. I'd like to prevent when a teacher uploads the same 'link' multiple time in different lessons that the 'link' is NOT shown multiple times but only once in a summery for the student

I was thinking for a conditional like {if link == link} {/if} or would a conditional with count be in order for this.

Hope someone can help?

{exp:playa:parents channel="teacher" status="not closed"} {link} {/exp:playa:parents}

Thanks in advance

Dave

1 Answer 1

1

Are you using Stash already? If so, you can use its unique parameter to exclude duplicates. Something like this:

{!-- ====================================
SET
========================================= --}

{exp:stash:set_list name="links" trim="yes" parse="yes"}
  {exp:playa:parents channel="teacher" status="not closed"}
    {stash:the-link}{link}{/stash:the-link}
  {/exp:playa:parents}
{/exp:stash:set_list}

{!-- ====================================
GET
========================================= --}

<ul>
{exp:stash:get_list name="links" unique="yes"}
  <li><a href="{the-link}">{the-link}</a></li>
{/exp:stash:get_list}
</ul>
1
  • Thanks, that worked. I wasn't using stash yet but it seems it can do a lot of things and speed up my templates.
    – Dave_Daliz
    Commented Jan 14, 2015 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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