Jump to content

Removing parent from url...prevents pagination from working correctly?


J_Szwarga
 Share

Recommended Posts

This one has got me scratching my head for 2 days so hoping someone can shed light...

I have a couple grand-child pages that require a top-level url for business reasons. I followed the ideas present in this thread and they work great...

1. Enabled url segments on home page
2. Add code to home.php that looks for specific url segment and outputs appropriate grand-child page instead of home page.
3. Add hook before "Page::path" that removes the parent from the generated url segment.

So now instead of /calendar/events, it now works as just /events

However, one of these grand-child pages (/calendar/events) also uses pagination to present a list of items.
Before making the above changes, pagination works correctly...the url that gets generated with "renderPager()" to get to page 2 results is like this:

calendar/events/page2

After adding the above code to remove the "parent" from the grand-child url, I would expect the "renderPager()" to return THIS:

/events/page2

but instead it is returning THIS:

/events/events/page2

Which of course, doesn't work.

After clicking the page 2 link (/events/events/page2) the page re-renders with all page 1 results still, and then the pager continues to generate bad links, this time like:

/events/events/events/page2/page2

 

Is there a known issue with combining url segments with pagination on the same page?

If I need to, I'll end up just doing a permanent redirect from my top-level urls down to the grand-child pages, if that's the only way to get pagination to work. I was hoping for another way unless this is a know and un-fixable issue.

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...