My goal was to mark current/active article on the list. Code looks like:

<ul class="list-plain">
{exp:channel:entries channel="products" category="{segment_3_category_id}" orderby="title" sort="asc" status="open" paginate="bottom" dynamic="no"}
{if switchee_no_results}<div class=""><p>No entries yet.</p></div>{/if}
<li {if segment_4=="{url_title}"} class="current"{/if}><a href="{site_url}{segment_1}/{segment_2}/{segment_3}/{url_title}">{title}</a></li>        

but no class added to the proper list item.

Then I have decided to check if IF statement works and did simple test run

Seg: {segment_4} - URL: {url_title}
{if segment_4=="{url_title}"}FOUND!{/if}

no result found even there was proper Seg to Url match.

Then I have checked if there is no results

Seg: {segment_4} - URL: {url_title}
{if segment_4=="{url_title}"}FOUND!{if:else}NOT FOUND{/if}

and I have got proper matches.

Any clue what is going on?


  • In the selection of the channel:entries you are selecting products by category of segment 3. In the check you are comparing category on segment 4. Is that correct?
    – Timo002
    Commented Feb 18, 2014 at 0:13
  • OP code updated with proper tag - it was some of my tests to get it to work. To be clear - I'm selecting product lists based on category from segment 3 and segment 4 is a product url_title Commented Feb 18, 2014 at 15:54
  • Maybe you need to use this? {if "{segment_4}"=="{url_title}"}? So putting the segment_4 between quotes.
    – Timo002
    Commented Feb 18, 2014 at 15:56
  • Well, strange but that works. You can post it as an answer. Thanks! Commented Feb 18, 2014 at 16:37

1 Answer 1


You are comparing two variables where you compare one with quotes "" and one without. So that probably gives a mismatch because it compares the two variables as different types.

So change this:

{if segment_4=="{url_title}"} class="current"{/if}


{if "{segment_4}"=="{url_title}"} class="current"{/if}

probably also this would work (not tested).

{if {segment_4}=={url_title}} class="current"{/if}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.