ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

segment conditional

July 27, 2011 4:30am

Subscribe [3]
  • #1 / Jul 27, 2011 4:30am

    Charming Nerd

    196 posts

    Is there some reason this OR statement wouldn’t work? Cause it isn’t working for me.

    {if segment_1 != "partners" OR segment_1 != "contact"}
                
        my code
                
    {/if}
  • #2 / Jul 27, 2011 7:55am

    Dave @ Exp:resso

    465 posts

    Maybe its just late and my brain isn’t working, but that doesn’t seem like necessary conditional logic - try AND. I’m guessing you want to display content if a page isn’t ‘contact’ or ‘partners’. In that case the conditional would be

    {if segment_1 != "partners" AND segment_1 != "contact"}
    content
    {/if}

    This would also accomplish the same thing:

    {if segment_1 == "partners" OR segment_1 == "contact"}
    {if:else}
    content
    {/if}
  • #3 / Jul 29, 2011 5:37pm

    Charming Nerd

    196 posts

    Thanks. AND work, but I don’t understand why OR doesn’t.

  • #4 / Jul 29, 2011 10:26pm

    Dave @ Exp:resso

    465 posts

    Yeah its quite confusing to get your head around, its just an issue with the logic. Doesn’t really make sense in your case since both parts of the OR statement can be true. I’m not exactly a PHP guru but you should only use OR when only one statement can return true

  • #5 / Sep 26, 2011 4:47pm

    bmovie

    619 posts

    OR dont work to me too, is a php thing, or a ee bug?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases