Jump to:

23550 Posts in 19336 Topics by 2890 members

General Questions

SilverStripe Forums » General Questions » Adding unlimited items to a page

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: 254 Views
  • Bagzli
    Avatar
    Community Member
    37 Posts

    Adding unlimited items to a page Link to this post

    Hello,

    I was wondering how can I set up so that you can create unlimited items on the page. For example, I want to give the user to add as many images to the page as they want, and then for each image, I want them to be able to enter as many lines of text as they want that will go next to the image. Each line of text will be a new <p>. My issue is I do not know how to achieve the unlimited part with silverstripe, I don't want them adding a new page every time they want an item, there must be a better way.

  • Fred C.
    Avatar
    Community Member
    18 Posts

    Re: Adding unlimited items to a page Link to this post

    The key is to make a has_many relationship between Page and Image. Image is supposed to have a Content field, but for some reason that is not exposed in the CMS. My colleagues have come up with an ImageAttachment data object to provide the additional fields. See this gist: https://gist.github.com/oddnoc/fd30108287db7ac32b00

  • Bagzli
    Avatar
    Community Member
    37 Posts

    Re: Adding unlimited items to a page Link to this post

    Thank you for the reply, I will try this sometimes this week when I have more free time! Thanks again!

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