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   1013 Views

Avatar
lx

Community Member, 83 Posts

28 July 2010 at 6:58am

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

Forum Moderator, 5513 Posts

28 July 2010 at 6:42pm

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.