Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » controller for m:n - and a connected further Table

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

Page: 1
Go to End
Author Topic: 1042 Views
  • lx
    Avatar
    Community Member
    82 Posts

    controller for m:n - and a connected further Table Link to this post

    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.

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: controller for m:n - and a connected further Table Link to this post

    <% 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

  • lx
    Avatar
    Community Member
    82 Posts

    Re: controller for m:n - and a connected further Table Link to this post

    thanks. Thats it. Shame on me.

    1042 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.