Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Uploading downloadable documents

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 286 Views
  • bananaswim
    Community Member
    2 Posts

    Uploading downloadable documents Link to this post


    Am totally new to Silverstripe so am only competent with absolute basics at the moment. Currently I am just working on getting the content up and a vague order to things - I will work on the aesthetics later when I understand a bit more.

    I need to have a section where I can have documents such as forms and information packs that people can download. So word and pdf documents which you can click on and either open or download. How possible is this and if it's easy, how do I go about it?

    Please use simple language if explaining else I won't have a clue!


  • zenmonkey
    Community Member
    528 Posts

    Re: Uploading downloadable documents Link to this post

    Super simple, if you don't need front end upload. You'd just need to create a cusotm page type http://doc.silverstripe.org/framework/en/tutorials/1-building-a-basic-site and give it a $has_many relation with the File Object http://doc.silverstripe.org/framework/en/tutorials/5-dataobject-relationship-management

    Then in that custom page template call some thing like
    <% loop Files %>
    <a href="$Filename">$Name</a>
    <% end_loop %>

    This assume you create the relation as
    static $has_many = array("Files" => "File",);

    In the template you could also use $Title instead of $Name if you don't want to see the extension.

    Welcome to SilverStripe. I started using it a few years ago with 0 PHP knowledge, great way to learn since it handles all the messy parts of the Database part and wraps it in a really easy to use/learn method

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.