Hey there,
Sorry for what must be a fairly basic question. Our entries often have several categories assigned. I just want to be able to display a specific box if this entry does not have a certain category assigned to it.
{categories}
{if category_url_title != "some-category"}
<div>THING TO BE DISPLAYED GOES HERE.</div>
{/if}
{/categories}The above is what I want to do but it’s obviously wrong. As it will check each of the categories that the entry is assigned to and show the div each time the category doesn’t match.
Is there a way I can basically say show this code if the category “category-name” doesn’t match any of the categories assigned to this entry?
I think the easiest solution for you might be an embed. In that template you’d have
{embed="site/check_for_category" entry_id="{entry_id}" cat_id="1"}cat_id would be the ID of the category you want to check if the current entry is assigned to. Then your embedded template site/check_for_category would have the following code:
{exp:channel:entries entry_id="{embed:entry_id}" category="{embed:cat_id}" limit="1" dynamic="off" disable="member_fields|custom_fields|pagination"}
{if no_results}display this if not found{/if}
{/exp:channel:entries}Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.