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.

General Questions /

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

Create a download list automatically


Reply


5 Posts   665 Views

Avatar
suntrop

Community Member, 131 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, 137 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
[url]http://www.nobrainer.dk/[/url]

Avatar
zenmonkey

Community Member, 532 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, 131 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!