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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

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

Yearly Archive bug and solution


Go to End


2 Posts   1521 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.