We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Stuck on getting a route to work properly

How Do I?

Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

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

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

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?

       
James Mathias's avatar
James Mathias
225 posts
8 years ago
James Mathias's avatar James Mathias

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.

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

Hey James,

I’ll take a look, but have a look at this report I’ve put in here - https://support.ellislab.com/bugs/detail/22420/Pagination-doesnt-work-properly-with-routes

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

Hey James,

Even doing a route like

/{country:regex[(zh|cn|usa)]}/news-and-resources/{page:pagination}

which should explicitly match

example.co.uk/usa/news-and-resources/P3

and it still fails

Something really isn’t right here?

Andy

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

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

       
James Mathias's avatar
James Mathias
225 posts
8 years ago
James Mathias's avatar James Mathias

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.

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

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

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

Hey James,

Any news on this one?

Andy

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

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

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
8 years ago
Ingmar Greil's avatar Ingmar Greil
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.

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

Yes Ingmar, thank you. But this isn’t so much as a support request as a clarification of a bug. See the bug report.

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn
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

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
8 years ago
Ingmar Greil's avatar Ingmar Greil

A bug report is not the kind of ticket I was referring to. You know, the kind that actually comes with guaranteed response times.

       
Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
8 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

Yes, thank you for your sarcastic responses, I’m fully aware.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.