Hello All,
I'm using the Navigator module to show a list of child pages. I've looked at the parameters but I can't seem to find a way to sort the pages on the front end. I know that on the backend the latest added page is at the bottom of the list which is fine but I need the newest to be displayed at the top. Any one have any ideas?
Thanks,
James
Navigator Sort Order
Re: Navigator Sort Order
Navigator uses the order assigned in the backend, so the simplest option is to reorder the pages as desired (there's a drag and drop utility for doing this).
If that's not a desired option you can sort the $data array in your Navigator template before the foreach. See https://cmscanbesimple.org/blog/sort-array-modifier for inspiration.
You can also use javascript/jquery to sort the output, which is handy if it's only a specific part of the menu you want to sort.
If that's not a desired option you can sort the $data array in your Navigator template before the foreach. See https://cmscanbesimple.org/blog/sort-array-modifier for inspiration.
You can also use javascript/jquery to sort the output, which is handy if it's only a specific part of the menu you want to sort.
Not getting the answer you need? CMSMS support options
Re: Navigator Sort Order
Hi Digi,
Thanks for getting back to me.
Just for added context, the pages are Case Studies which are divided into 2 categories (commercial, domestic). I could just use a LISE instance called Case Studies and use the category field definition but as far as I'm aware, there isn't a way to include the category on the automatically generated url of an LISE item.
Thanks,
James
Thanks for getting back to me.
I'm afraid that this can't work as there are currently 30 or so pages and there are more to be added.Navigator uses the order assigned in the backend, so the simplest option is to reorder the pages as desired (there's a drag and drop utility for doing this).
I think I'll explore this option as I can't really use javascript/jquery due to the potential number of items.If that's not a desired option you can sort the $data array in your Navigator template before the foreach. See https://cmscanbesimple.org/blog/sort-array-modifier for inspiration.
Just for added context, the pages are Case Studies which are divided into 2 categories (commercial, domestic). I could just use a LISE instance called Case Studies and use the category field definition but as far as I'm aware, there isn't a way to include the category on the automatically generated url of an LISE item.
Thanks,
James
Re: Navigator Sort Order
I should add, if it's simply reversing the order, you can try |@array_reverse on the $data array. It may require permissive_smarty to be enabled in your config.php.
Not getting the answer you need? CMSMS support options
Re: Navigator Sort Order
Hi Digi,
I should've checked for replies earlier. I've just created a reverse_array modifier based on the sort_array modifier you suggested. I can confirm that |@array_reverse works without enabling permissive_smarty.
Thanks again for your help.
James
I should've checked for replies earlier. I've just created a reverse_array modifier based on the sort_array modifier you suggested. I can confirm that |@array_reverse works without enabling permissive_smarty.
Thanks again for your help.
James