Navigator Sort Order

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
WDJames
Forum Members
Forum Members
Posts: 64
Joined: Tue Feb 13, 2018 1:09 pm

Navigator Sort Order

Post by WDJames »

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
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Navigator Sort Order

Post by DIGI3 »

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.
Not getting the answer you need? CMSMS support options
WDJames
Forum Members
Forum Members
Posts: 64
Joined: Tue Feb 13, 2018 1:09 pm

Re: Navigator Sort Order

Post by WDJames »

Hi Digi,

Thanks for getting back to me.
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'm afraid that this can't work as there are currently 30 or so pages and there are more to be added.
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.
I think I'll explore this option as I can't really use javascript/jquery due to the potential number of items.

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
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Navigator Sort Order

Post by DIGI3 »

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
WDJames
Forum Members
Forum Members
Posts: 64
Joined: Tue Feb 13, 2018 1:09 pm

Re: Navigator Sort Order

Post by WDJames »

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
Post Reply

Return to “Modules/Add-Ons”