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

February 23, 2012 12:01pm

Subscribe [1]
  • #1 / Feb 23, 2012 12:01pm

    Hi, I am having such a silly issue here.

    I have done this many times before, but for some reason today my brain is failing.

    I am using a conditonal to say if segment 4 is the same as the category url title to display a class.

    {if segment_4 == "{category_url_title}"}class="highlight"{/if}

    For some reason it isn’t working. I have checked that the category url title is outputting correctly.

    The strange thing is, it isnt even adding the class, so its not something to do with my CSS.

    Any ideas?

    Thanks

  • #2 / Feb 23, 2012 11:25pm

    Kevin Smith

    4784 posts

    Hi Chris,

    Sounds like this is likely a parse order problem. I suspect the {category_url_title} isn’t available by the time that conditional needs to evaluate. Have you tried swapping them? Something like:

    {if category_url_title == segment_4}class="highlight"{/if}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases