I'm looping through my entries, and I want to check if my entry has a certain entry as his playa parent.
Right now I'm using this code, which works, but I'm wondering if it can be done without PHP.
{exp:channel:entries channel="project"}
<?php $hasParent = false; ?>
{project_categorie}
{if segment_2 == url_title}
<?php $hasParent = true; ?>
{/if}
{/project_categorie}
<?php if($hasParent){ echo "wooptidoo"; }?>
{/exp:channel:entries}
so, this runs through my playa related entries, checks to see if the url_title matches my quert ( segment_2 in this case ) and displays this once.
Another example of this functionality would be: checking to see if you entry is in a certain category. f.ex:
{exp:channel:entries channel="project"}
<?php $isInCategory = false; ?>
{categories}
{if segment_2 == category_url_title}
<?php $isInCategory = true; ?>
{/if}
{/categories}
<?php if($isInCategory){ echo "wooptidoo"; }?>
{/exp:channel:entries}
can this be done without having to use PHP ?
EDIT:
--------------------
Ok, I have not idea why I didn't think of this before, but this works perfectly..
{exp:channel:entries channel="project"}
{project_categorie}
{if segment_2 == url_title}
wooptidoo
{/if}
{/project_categorie}
{/exp:channel:entries}
stuuupid. :)