I'm using Switchee to detect pagination.

Switchee is working fine for: /new/PX/

I also use Zoo Triggers for categories and archives and have the following pagination URL's too:

  • /news/category/abc/PX (segment 4)
  • /news/archive/yyyy/mm/PX (segment 5)

It doesn't look like I can pass multiple values to the variable parameter so is it best to call Switchee multiple times in the template or is there a better approach?

{exp:switchee variable="{triggers:segment_2}" parse="inward"}
    {case value="#^P(\d+)$#"}
    // Do something
    {/case}

    {case value="''" default="Yes"}
    // Do something
    {/case}
{/exp:switchee}

{exp:switchee variable="{triggers:segment_4}" parse="inward"}
    {case value="#^P(\d+)$#"}
    // Do something
    {/case}

    {case value="''" default="Yes"}
    // Do something
    {/case}
{/exp:switchee}

{exp:switchee variable="{triggers:segment_5}" parse="inward"}
    {case value="#^P(\d+)$#"}
    // Do something
    {/case}

    {case value="''" default="Yes"}
    // Do something
    {/case}
{/exp:switchee}

Any help would be appreciated!

  • as far as i know you can nest switchee too. that would help, wouldn't it? – Jelle Dijkstra Dec 16 '13 at 17:38

I tried Bjorn's last segment plugin to get the absolute last segment and that worked. Weird...

http://devot-ee.com/add-ons/bjorn-last-segment

Switchee tag:

{exp:switchee variable="{exp:last_segment ignore_pagination='no'}" parse="inward"}

{triggers:last_segment} ?

And here's a useless sentence to make this answer long enough to post...

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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