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.

Template Questions /

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

controller for m:n - and a connected further Table


Go to End


3 Posts   1781 Views

Avatar
lx

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.

Avatar
(deleted)

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

Avatar
lx

Community Member, 83 Posts

16 April 2009 at 8:38pm

thanks. Thats it. Shame on me.