Hey guys,
So I’m using the following route on my template
/{country:regex[(zh|cn|usa|)]}/{pagename:regex[(news-and-resources)]}/{pagecategory:alpha_dash}/{pagination:pagination}
Yes, you’ll see that I’ve done
regex[(zh|cn|usa|)]
with that extra pipe, I’ll explain why below:
The route I’m using controls what data is shown based on geolocation and page category for the main part.
An example URL would be something like
example.com/usa/news-and-resources/news
However if no country variable is set, it defaults to UK version of content, this is why that extra
|
is present. Without this, the route fails.
So,
example.com/usa/news-and-resources/news
example.com/news-and-resources/news
Both load correctly using this route, however…
If I load
example.com/usa/news-and-resources/news/P3
Which is using the pagination, the route throws a 404 error, even though there are results that should show.
If I do the same, without the country parameter,
example.com/news-and-resources/news/P3
the route works fine
So what I can gather from my testing, isn’t so much the country bit at the beginning of the URL, but more likely the structure towards the end of the route. It seems as though the
/{pagecategory:alpha_dash}/{pagination:pagination}
portion is where the problem lies.
I know this is likely an unconventional use of the template routes but unfortunately this is what’s needed for the current project.
I can’t post the link publicly but feel free to PM me if you need to see anything
Andy
Interestingly, when I use the Resource Router plugin that’s available on Devot-ee, and I create a route that matches the same as this EE one, it still fails when pointing to my news-and-resources template, HOWEVER, if I point the route to the index template, it works.
So it looks like there is a problem with the pagination itself?
Hi Andy,
My understanding of the docs for pagination and categories in a route is that you have to use the {page:pagination}
for pagination, you are using {pagination:pagination}
and for categories you need to use {section:category}
if you are using IDs or /category/{section:alpha_dash}
if you are using category url_titles, this case you would change category
to the value you have set in the CP for “Category URL segment” you are using {pagecategory:alpha_dash}
It’s possible I am wrong on this, but it’s my understanding from reading the docs.
I’ve tested this extensively. Using the Resource Router plugin I created a route like this
'(usa|cn|zh)/news-and-resources/:pagination' => 'www/index'
just to check that it reads the route and of course, it loads the index template as required.
So, there is quite clearly a bug in EE somewhere that it just cannot load the other route properly - it’s incredibly frustrating and no one is looking at my bug report either :/
Would be great if we could have a system like you’ve just implemented for the search module where we can specify what segment holds the P3
or whatever number it is for pagination.
Just weird how this specific route doesn’t work, but all the other ones with the pagination do
Andy
Hi Andy,
Yeah it looks like this could be a bug.
I do understand your frustration, and I’m sorry that you’ve hit this bug with routes. Unfortunately, we are a small team and as such we have to prioritize all the incoming feedback and issues. Please don’t misunderstand me, every customer is important, but we have to have a priority scale or else we won’t ever be able to get anything fixed or done.
Hey James,
It’s not a problem, would just be good to have acknowledgment of the tickets fairly soon after they’re created, not even looked into, just noted that you guys have read what the problem may be so that reporters know that their problem is put on your list to look into.
I know you’re a small team and completely appreciate that and the speedy turnaround on other bugs.
Thanks for getting back to me 😊
Andy
Hi guys,
Been nearly 2 weeks and no response on the bug report. Has anyone had a look into this yet as we’ve got a site that needs to go live soon and this bug breaks the functionality for people located in the USA or China.
Would be good to hear from you soon, or at least on my bug report - https://support.ellislab.com/bugs/detail/22420/Pagination-doesnt-work-properly-with-routes
Been nearly *2 weeks* and no response from you. Has anyone had a look into this yet as we’ve got a site that needs to go live soon and this bug breaks the functionality for people located in the USA or China.
You do know this is a community forum, right? All official support is handled via tickets.
ETA: Looks like you might have opened one with support? In this case you should probably follow up there, just saying the forums is not regularly and officially watched by support.
ETA: Looks like you might have opened one with support? In this case you should probably follow up there, just saying the forums is not regularly and officially watched by support.
Yeah, I posted a bunch of replies on my report that should help narrow down the error but even that hasn’t had any acknowledgment yet. I think patiently waiting 2 weeks for a reply is fair on a bug report
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.