Q:

Problem with category conditional

I always seem to run into some problems with conditionals. The code in question is this:
{categories}
{if category_id != "305|325"}

Index version 1

{/if}

{if category_id == "305|325"}

Index version 2

{/if}
{/categories}

At the moment, it is always returning version 1 of the index, even when the category of the entry matches 305 or 325.

A:

If I'm not mistaken, for OR conditionals you must use one of the following:
{if category_id != 305 OR category_id != 325}

{if category_id != 305 || category_id != 325}

also, please double check that you don't need to use AND instead of OR. I've tripped myself up with that many times - especially when using negative comparison.
{if category_id != 305 AND category_id != 325}
     index 1 ---- the cat id is not 305 AND it is not 325
{if:else}
     index 2  --- all other cat ids
{/if}

OR...
{if category_id == 305 OR category_id == 325}
     index 2  ---- the cat id is 305 OR it is 325
{if:else}
     index 1 ---- all others
{/if}

