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

Adding unlimited items to a page


Reply


3 Posts   351 Views

Avatar
Bagzli

Community Member, 37 Posts

12 July 2014 at 1:56pm

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.

Avatar
Fred Condo

Community Member, 21 Posts

13 July 2014 at 5:00am

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

Avatar
Bagzli

Community Member, 37 Posts

13 July 2014 at 10:09am

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