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:

Template Questions /

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

controller for m:n - and a connected further Table

Go to End

3 Posts   1438 Views


Community Member, 83 Posts

12 April 2009 at 4:42am

Hi, i am new to SS. So this might be a noob question.
I want a Sidebar on almost every Page. In this Sidebar i want some Download-Links to Files.
So i made a m:n - relation for Page:Downloads (names "SidebarDownloads"). Downloads is a dataObjectclass with a has-one-Relation to FILE.
This does work in CMS.

The Problem is the Template.
If i make a controller <% control SidebarDownloads %> i can access all Data from Table Downloads, beloging to this Page.
But the actual Filename is in class "File". How can i make a link in the Template?

Sorry for my bad english.


Community Member, 473 Posts

16 April 2009 at 2:11pm

<% control SidebarDownloads %>$FileName.Link<% end_control %> should do it, where FileName is the name of the has_one to a File in the Downloads DataObject


Community Member, 83 Posts

16 April 2009 at 8:38pm

thanks. Thats it. Shame on me.