0

I need to switch on 4 segments. I'm a little confused.

{exp:switchee variable="{segment_2}" parse="inward"}       
{case value="#^P(\\\\d+)$#|''"} 
         Show all categories
{/case}
    {case default="Yes"}
        {switchee variable="{segment_3}" parse="inward"}

            {case value="#^P(\\\\d+)$#|''"} 
            Show a specific category
            {/case}

            {case default="Yes"} 
            Show a specific sub-categories entries
            {/case}

            <!-- I need a fourth segment -->
            {case default="Yes"} 
            Show a specific product
            {/case}
            <!-- I need a fourth segment -->

        {/switchee}  
    {/case}  
{/exp:switchee}  
0

I'd try and start on the 4th segment then work your way back thru the segments using switchee. As it stands segment 2 will always be true (not sure what your regex is testing for though) pagination ?

| improve this answer | |
0

This does the trick:

{exp:switchee variable="{segment_2}" parse="inward"}
{case value="#^P(\\\\d+)$#|''"} 
Show all categories
{/case}

{case default="Yes"}

    {switchee variable="{segment_3}" parse="inward"}

        {case value="#^P(\\\\d+)$#|''"} 
        Show main category
        {/case}

        {case default="Yes"} 

            {switchee variable="{segment_4}" parse="inward"}

                {case value="#^P(\\\\d+)$#|''"} 
                Show subcategory products
                {/case}

                {case default="Yes"} 
                Show product
                {/case}

            {/switchee}

        {/case}

    {/switchee}

{/case} {/exp:switchee} 
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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