titanium Posted December 20, 2017 Share Posted December 20, 2017 Given three pages with the following titles: Deutschland Österreich Schweiz I noticed that I get different results for a sort inside a selector and an explicit sort(). See the following example: // A) just use selector as usual $countries = $pages->find('parent=countries,sort=title'); foreach($countries as $country) { echo $country->title . "\n"; } // result: Deutschland, Österreich, Schweiz - ok // B) put pages in separate array and sort afterwards $countries = $pages->find('parent=countries'); $whitelist = new PageArray; foreach($countries as $country) { $whitelist->add($country); } $whitelist->sort('title'); foreach($whitelist as $country) { echo $country->title . "\n"; } // result: Deutschland, Schweiz, Österreich - huh? It seems to be obvious that it has something to do with the umlaut in Österreich. Maybe a bug? Link to comment Share on other sites More sharing options...
FrancisChung Posted December 21, 2017 Share Posted December 21, 2017 Maybe this could be of use?https://processwire.com/talk/topic/12776-pw-3012-support-for-extended-utf8-page-namesurls/ Link to comment Share on other sites More sharing options...
kongondo Posted December 21, 2017 Share Posted December 21, 2017 I have not checked their inner workings, but the sort in A is done at the database level (SQL) whilst the sort in B is done at an in-memoy level (PHP). Maybe this difference has a bearing on the sorted results. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now