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.

{if last_segment != "work_for_us" AND last_segment != "for_candidates"}

September 09, 2011 9:12am

Subscribe [2]
  • #1 / Sep 09, 2011 9:12am

    JamesBrighton

    146 posts

    I need to display something so long as the last url segment is not one of a few different words. I’ve got it working with the following but is there a cleaner way to write it?:

    {if last_segment != "work_for_us" AND last_segment != "for_candidates"}

    I was hoping something like this would work:

    {if last_segment != "work_for_us"|"for_candidates"}

    The issue is that I will have quite a few segments, and if I insert a line-break in the 1st load of code it stops working. Thanks

  • #2 / Sep 09, 2011 2:01pm

    Mark Bowen

    12637 posts

    Hi James,

    What you have there looks fine to me.

    Your example won’t work as that isn’t currently supported in ExpressionEngine. You are welcome to make a Feature Request if this is something you would like to see though.

    Does that help?

    Thanks,

    Mark

  • #3 / Sep 12, 2011 5:38am

    JamesBrighton

    146 posts

    My code is working but I was wondering if there is any other way I could write it which would take up less space and be easier to read? Thanks

  • #4 / Sep 12, 2011 10:12am

    Mark Bowen

    12637 posts

    Hi James,

    The pipe | character isn’t currently supported in conditionals so you would need to do things the way you are doing at the moment. You are more than welcome to post a Feature Request if you like though.

    There may be some third party add-ons available over on devot-ee.com which might help out here too.

    I’m going to shift this post on over to the Community Help forums too so that it isn’t closed and you may get some input from other users on this too.

    Thanks,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases