All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Ignore Paginate segments when creating calculating last_segment_ variables

johndwells 4 Mar 2013 13:48 idea, complete

Hi Low,

I've got Seg2Cat installed to harness the "last_segment_" variables, but when visiting a Pagination URL (e.g. "/somewhere/cat/cat-name/P2"), the last_segment_ variables are all empty.

Any reason why Seg2Cat can't be modified to ignore this url if present? I've placed this at line 456 in ext.low_seg2cat.php:

// -------------------------------------- 
// Ignore if last segment is Pagination
// --------------------------------------
if (preg_match('/^[pP]\d*$/', $segment_array[$last]) == 1)
{
--$last;
}


Cheers,
John

Replies

  1. Low 4 Mar 2013 13:55

    Well, the reason it currently doesn't, is because neither does EE natively. The (now) native {last_segment} variable will reflect the last segment, regardless of pagination. Low Seg2Cat follows the same principle.

    But maybe it could be a setting...

  2. johndwells 9 Mar 2013 16:15

    Hi Low,

    A setting would be really helpful for my circumstance. What are the chances?

    Huge thanks,
    John

  3. Low 10 Mar 2013 13:39

    Take a look at the dev branch on github. Try that out and see if that works for you: https://github.com/lodewijk/low.seg2c...

  4. johndwells 11 Mar 2013 10:11

    You are a gentleman and a scholar!

    Thanks Low,
    John