22972 Posts in 11596 Topics by 2824 members
|Go to End|
14 December 2012 at 2:27am
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!
14 December 2012 at 3:51am
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 %>
<% 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
|Go to Top|