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.

General Questions /

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

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

Create a download list automatically


Go to End


5 Posts   1100 Views

Avatar
suntrop

Community Member, 141 Posts

28 September 2011 at 6:05am

I want to create a list or table of downloads with a title, description, icon and of course the download link.
I don't want to create a list within the editor, because it gets messed up quickly and I want it update automatically rather than edit the list manually.
Is there any plug-in or a best-practice?

Avatar
Ryan M.

Community Member, 309 Posts

28 September 2011 at 3:57pm

You could create some DataObjects and code a basic editor to use in the CMS, then for the front-end create some new .ss templates along with a page controller to handle the URL routing and resource requests.

Here are some tutorials:
http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/
http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-2-using-model-admin-and-url-segments-to-create-a-product-catalogue/

Avatar
Nobrainer Web

Community Member, 138 Posts

29 September 2011 at 2:23am

Edited: 29/09/2011 2:24am

Hi,

I think this post can be of good use to you:
http://www.silverstripe.org/data-model-questions/show/12951

It explains how to get a list of files from a folder.

If you need a long description and a custom file icon pr. file, then i guees you need to go with the Dataobject approach.

--

Thomas B. Nielsen
http://www.nobrainer.dk/

Avatar
zenmonkey

Community Member, 545 Posts

29 September 2011 at 8:18am

Filename, icon and link should be pretty easy and even handled pretty simply since you just need to access files whose parent is a certain folder. I've use similar methods to automatically pair images with product data during a csv bulk upload. The description is a little more tricky as that data isn't stored in the file and would need its own dataobject. I've also then used a tableListField with a checkbox to allow users to select multiple files and download as a single zip

Avatar
suntrop

Community Member, 141 Posts

29 September 2011 at 9:52am

Thanks all for your help. I think the links are a pretty good starting point for me.
I could skip the description but actually I want to know how I can get them in there :-)

I'll get my hands on it the next days.

Thanks a lot!