Closed susnux closed 5 years ago
These two options are not global options (just flags) so it is normal they don't appear in defaults and metadata. Even if sort_by_type
and sort_by_title
are false, sorting should still happen as long as sort_order
is not CATLIST_SORT_NONE
(0
).
Maybe there's a bug somewhere, but it's not obvious.
What is your value of the global option default_sort
?
To be more precise, the code for sorting is
if ($data['sort_order'] != CATLIST_SORT_NONE) {
usort($_TREE, function ($a, $b) use ($data) {
if ($data['sort_by_type'] && ( isset($a['_']) xor isset($b['_']) ))
return isset($b['_']);
$a_title = ($data['sort_by_title'] ? $a['title'] : $a['name']);
$b_title = ($data['sort_by_title'] ? $b['title'] : $b['name']);
$b = strnatcasecmp($a_title, $b_title);
if ($data['sort_order'] == CATLIST_SORT_DESCENDING)
$b = !$b;
return $b;
});
}
The bug may come from using the syntax `function ($a, $b) use ($data) {}` which appeared in PHP 5.3.0. Are you using an older version ?
Yeah was an invalid issue. Was https://github.com/xif-fr/dokuwiki-plugin-catlist/issues/34 combined with some wrong config.
Since the last update the sorting is broken, the config is missing the defaults (and metadata) for the config options
sort_by_type
andsort_by_title
(they default to false, so it gets sorted by INODE).