Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Yearly Archive bug and solution


Reply

2 Posts   995 Views

Avatar
lx

28 July 2010 at 6:58am Community Member, 83 Posts

The yearly archive doesnt work in 0.4.0.
For me it helped to fix the BlogTree.php like this:

in function BlogEntries($limit = null):

return $this->Entries("$start,$limit", $this->SelectedTag(), ($date) ? $date : '', null, $filter);
// return $this->Entries("$start,$limit", $this->SelectedTag(), ($date) ? $date->Format('Y-m') : '', null, $filter);

replace function SelectedDate() with:

function SelectedDate() {
      if($this->request->latestParam('Action') == 'date') {
         
$year = $this->request->latestParam('ID');
         $month = $this->request->latestParam('OtherID');

if(is_numeric($year) && ($month===null)) {
return $year;
}
   
if(is_numeric($year) && is_numeric($month) && $month < 13) {
   return $year .'-'. $month;
         }
      }
         
      return false;
   }

Avatar
Willr

28 July 2010 at 6:42pm Forum Moderator, 5511 Posts

You should submit bugs (and patches) to open.silverstripe.org if you haven't done so yet. Then the maintainers can get the fix into the release and help everyone else who runs into this issue.