Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » One page to many files relationship?

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1760 Views
  • noizy
    Avatar
    Community Member
    25 Posts

    One page to many files relationship? Link to this post

    I've got a site that currently has a one-to-one page-to-file relationship, created by adding this to my page.ss code; in the Page extends SiteTree...

    static $has_one = array(
    "Download" => "File",
    );

    ...and in function getCMSFields()...

    $fields->addFieldToTab("Root.Content.Download", new FileIFrameField("Download"));

    What I want to be able to do is to upload multiple files to the same page. I see some people have had success with one->many image relationships...

    http://www.silverstripe.com/general-discussion/flat/5853
    http://www.silverstripe.com/general-discussion/flat/1686

    Would a similar approach be feasible, using something like a hasmanycomplextablefield? Any suggestions, advice is welcome. Cheers.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: One page to many files relationship? Link to this post

    I don't see why not.

    The example in this post looks pretty much like what you're after:
    http://www.silverstripe.com/general-discussion/flat/5853

    Could you not make a dropdown for each line item, which points to an asset in the system? Or, are you looking to have a file uploader for each item, so you upload the file on the spot?

    Cheers,
    Sean

  • noizy
    Avatar
    Community Member
    25 Posts

    Re: One page to many files relationship? Link to this post

    "Or, are you looking to have a file uploader for each item, so you upload the file on the spot?"

    Yep, that one.

    The FileIFrameField gives the exact functionality I require for a single file (ie. I can upload a new file to the system, or select an existing one from the filestore), I just need to duplicate that behaviour multiple times on the same page.

    The way I envision it is that when you upload/add the first file, a second FileIFrameField appears upon the first file being attached to that page. ie. you've always got count(submitted FileIFrameFields)+1 on the admin page.

    The last post by jam13 on the http://drupal.org/node/155743 thread does look like what I'm after - I just haven't implemented a HasManyComplexTableField before, so was wondering if it was going to do the job for me in this instance. One way to find out, I suppose...

  • jam13
    Avatar
    121 Posts

    Re: One page to many files relationship? Link to this post

    I'd be interested if you come up with a good solution for this. I eventually abandoned it and went for a workaround solution because HasManyComplexTableField wasn't a very practical system for Images (or I imagine files).

  • Daminipo
    Avatar
    Community Member
    14 Posts

    Re: One page to many files relationship? Link to this post

    >The way I envision it is that when you upload/add the first file, a second FileIFrameField
    >appears upon the first file being attached to that page. ie. you've always got count(submitted
    >FileIFrameFields)+1 on the admin page.

    That's just what I'm searching at the Moment. Hay anyone found the solution to that?
    It would be greatly more User friendly if it could act that way.

    I got problems using the FileIFrameField on the HasManyComplexTableField realtion. The solution that was shown here: http://www.silverstripe.com/general-discussion/flat/5853

    1760 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.