Ordering Date Nav by a custom date attribute
PermalinkIt looks like I need to ovverride the date_nav.php file found in concrete\core\controllers\blocks. I just don't know what to change in that file to order by a custom attribute.
I am trying to order my date navigation on a custom attribute as well.
However if I use your code snippet it does not seem to work correctly.
I modified the variable $pl in my controller.php in my blocks > date_nav folder (!! not in the core directory !!);
My variable reads: $pl->sortBy('item_start', 'desc');
however it does not order my date_nav accordingly.
When I change the $pl to another custom attribute (address) it reorders the date_nav alphabetically. So it seems to work, just not when I try to order based on a date. Do I have to use a specific date format?
Is it possible for you to post the entire modified controller.php so I can see what I amn doing wrong?
Or do you have any pointers as where I have to look for my solution.
Any help would be much appreciated.
with kind regards,
Patrick
To be honest I did not have time to test it out yet.
But when I get to it I will let you know if it worked.
Thanks for your help.
I wanted to override the core date nav controller from a custom template so that it would sort by a custom date attribute. I found the core date_nav controller in concrete=>core=>controllers=>blocks=>date_nav.php. I copied the function that containined the sortBy code and pasted it in my custom template's controller.php file and changed the sortBy part of the function like this:
Then I loaded my newly edited controller.php file to blocks=>date_nav.
I wasted some time loading the controller.php file to blocks=>date_nav=>templates=>my_template.