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

LinkingMode Functionality in Year Archive


Go to End


3 Posts   1616 Views

Avatar
timwjohn

Community Member, 98 Posts

15 June 2011 at 9:33am

Hi again,

I've created a method in my page class that outputs a list of blog publication years for use in my navigation:

	public function getBlogYears()
	{
		$archivewidget = new ArchiveWidget();
		$archivewidget->DisplayMode = 'year';
		return $archivewidget->Dates();
	}

In template:

	<ul class="nav">
		<% control BlogYears %>
			<li>
				<a href="$Link" class="$LinkingMode">$Date.Year</a>
			</li>
		<% end_control %>
	</ul>

It's outputting the dates and linking them perfectly.

I didn't expect $LinkingMode to work. How would I get that functionality in this case, so the selected year can be highlighted?

Avatar
TomMiller

Community Member, 26 Posts

15 November 2011 at 2:51am

Hi timwjohn,
i'm currently having the same issue with linkingmode. Have you found a solution?

Tom

Avatar
timwjohn

Community Member, 98 Posts

17 November 2011 at 12:42am

Edited: 17/11/2011 12:42am

Hi Tom,

No I abandoned this and used the vanilla archive widget. One thing that just sprung to mind is the use of InSection(). Not sure if it would work, but perhaps you could test InSection(Date.Year) or something like that?

Let me know if you have any success.

Tim