ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry but I'm unable to use switchee.. how can i set AND conditionals?

this is my original code:

<!--The Categories Page ////////////-->
{if segment_2=="" AND segment_3==""}

<!--The Category Entries Page //////-->
{if:elseif segment_2!="" AND segment_3==""}

<!--The Single Entry ///////////////-->
{if:elseif segment_3!=""}



share|improve this question
In this case it would be more useful using ifelse than switchee. Developed from the same author: Marc Croxton. – Stéphane Mar 2 '14 at 17:43
Yeah! ifelse works well in this case, thank you Stéphane – Valerio Mar 2 '14 at 18:44
up vote 2 down vote accepted

It's easy, actually. You can concatenate both segments. I used to use some RegEx for this, but I just got the idea to take advantage of the parsing order.

Please, try this:

{exp:switchee variable="{segment_2}/{segment_3}" parse="inward"}
    {case value="/"}
    {case value="{segment_2}/"}
    {case value="{segment_2}/{segment_3}"}

There's no performance gain by using switchee on this case because the embeds are parsed after the advanced conditionals.

share|improve this answer
Thank you Robson, I'll try your solution and the if else add-on by Marc Croxton too.. I really need to boost the performance – Valerio Mar 2 '14 at 18:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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