{exp:channel:entries channel="courses" dynamic="no" orderby="title" sort="asc" search:course_category="{embed:entry_id}" search:sub_cat="{embed:subentry_id}"}
Test {course_category}{entry_id}{/course_category} vs {embed:entry_id} - {sub_cat} {entry_id}{/sub_cat} vs {embed:subentry_id}
{embed="includes/.testcourse" compare="{course_category}{url_title}{/course_category}" page="{embed:page}" subcat="{embed:subcat}" subcatc="{sub_cat}{url_title}{/sub_cat}" title="{name_for_menu}" url="{url_title}" brand="{embed:brand}" {if url_title == "{embed:url_title}"}class="active"{/if}}
{/exp:channel:entries}
Ok, this code basically checks the category and the sub-category of the course are correct before adding them to the page.
Heres the bad part:
Test 15 vs 5 - 29 vs 9 Makaton Signing for Babies
Test 15 vs 5 - 29 vs 9 Parent and Carer
DOH! Clearly they don't match, its just found them because it contains them
Now, I figured this was just because I hadn't used exact match searching, so i changed the code to:
{exp:channel:entries channel="courses" dynamic="no" orderby="title" sort="asc" search:course_category="={embed:entry_id}" search:sub_cat="={embed:subentry_id}"}
Test {course_category}{entry_id}{/course_category} vs {embed:entry_id} - {sub_cat}{entry_id}{/sub_cat} vs {embed:subentry_id}
{embed="includes/.testcourse" compare="{course_category}{url_title}{/course_category}" page="{embed:page}" subcat="{embed:subcat}" subcatc="{sub_cat}{url_title}{/sub_cat}" title="{name_for_menu}" url="{url_title}" brand="{embed:brand}" {if url_title == "{embed:url_title}"}class="active"{/if}}
{/exp:channel:entries}
And now no entry shows despite (more code from the previous debug): Test 5 vs 5 - 10 vs 10 Business Administration Test 5 vs 5 - 10 vs 10 ChildCare Test 5 vs 5 - 10 vs 10 Customer Service Test 5 vs 5 - 10 vs 10 Hospitality and Catering Test 5 vs 5 - 10 vs 10 Hospitality Supervision
Now I can't see why they wouldn't match the correct ones on an exact match search (I've tried it with quotes around to check for nbsp or similar)
As you may have guessed {course_category} and {sub_cat} are playa fields. So how do I do an exact match search vs a playa element?
Thanks!!