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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Blog Module /

Discuss the Blog Module.

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

Yearly Archive bug and solution


Go to End


2 Posts   1265 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, 5523 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.