Jump to content

Using repeater fields - when to use & when not?


Vineet Sawant
 Share

Recommended Posts

Hello all,

I've been using repeater fields for many purposes. Mostly I use it to store multiple entries of similar kinds of data in a single page.

A while ago Ryan answered one of my questions related to repeaters here.

That is when I started wondering if I'm misusing the repeaters and probably will have to pay for it later when the site grows.

So this question is just to understand the Do's and Don'ts about repeaters. I hope this will be informative for everyone & useful for not so bright people like me. :)

Thank you.

Link to comment
Share on other sites

Short answer: if it has to scale without a known limit use pages. Let's say a log module which saves pages with user login info you use pages since this might scale up to a large number. If you are creating a slider/carousel with a couple slides you can use a repeater.

Also if you have to use the API extensively you better use pages since you can use selectors or PageArray to sort and filter data.

  • Like 3
Link to comment
Share on other sites

I'd say that if you know for sure that there won't be more than is usable considering the repeaters UI. My "limit" would be around 20-30 items. Technically it scales for more (especially with simple items).

  • Like 2
Link to comment
Share on other sites

Repeater field will append user's email ID with his/her name.

I've read your sentence a couple of times but I have a hard time understanding it, Vineet. What is an user email id? 

Link to comment
Share on other sites

I've read your sentence a couple of times but I have a hard time understanding it, Vineet. What is an user email id? 

I'm so sorry Arjen, I wanted to say is, user will input their email addresses(on which they wish to receive newsletter) to sign up for newsletters. We in the backend, will retrieve these emails from repeater field and shoot newsletters to them.

So this repeater field will store name of the user & his/her name. Note, these users may or may not be registered users of the website.

Link to comment
Share on other sites

For storing data like the subscriptions i wouldn't use repeaters. I would use pages or else a custom table in db. Even if the max number of subscibers wil be 20 or so. The next time you will need the script, you've probably to rewrite the whole script cause that that low amount of subscribers is rare i think. Handling data from repeaters is more tricky and need more custom code then when you use pages as storage.

My need for repeaters are rare, maybe for an image slider or populate tables.

  • Like 2
Link to comment
Share on other sites

I agree that repeaters are definitely not the way to handle an email subscription database. PW's database could certainly handle it, but it wouldn't be scalable at the UI level in the admin. 

A great way to handle user subscriptions is to make use of the tools provided by dedicated services like MailChimp or ConstantContact, etc. Another great way is to use FormBuilder, which will save your subscriptions in it's own database and let you export them to a spreadsheet for import at your distribution service. It will even let you cross-post them to your own database and your distribution service at the same time (depending on what service you are using). 

  • Like 1
Link to comment
Share on other sites

  • 4 years later...

I know this topic is really old right now, but I think the reason to decide for either pages or a repeater hasn't changed.

I make heavy use of repeaters on a template with the name "Actor". An actor has many Movies, Television Series and Theater Plays he starred in. He will also get several awards for these works. Creating tab pages and add some repeaters seems really easy and is also a comfortable way to create a whole new actor's page.

If I would change it to pages, the page tree would have to look like this:

  1. Tom Taller
    1. Movies
      1. First Movie
      2. Second Movie
    2. Television
      1. Top Series
    3. Awards
      1. Top Actor 2017
  2. James Brunette
    1. Movies
      1. First Movie
      2. Second Movie
    2. Theater
      1. Code 1007

For the one who created this pages, it should be easy and comfortable. So he shouldn't create a "Category"-Page (like "Movies") on his own. What template type would the category pages even have? To create the child pages without those category parents would look a way to mixed if you have about 1000 entries of  different types.

What do you think? I wouldn't need a Movie, Theater, Series and Awards database in form of structures pages, like in the Structure Tutorial somewhere on this page. The administrative effort would be too high, because most of the entries will only be used once.

I hope to hear from you :)

 

Link to comment
Share on other sites

6 hours ago, ov3rtak3r said:

I know this topic is really old right now, but I think the reason to decide for either pages or a repeater hasn't changed.

Repeaters can scale up much better in recent versions of PW, so long as you set your repeater items to collapsed by default and use the AJAX-loading option.

6 hours ago, ov3rtak3r said:

If I would change it to pages

I suggest creating a page structure where you have a dedicated parent and template for each of Movies, Television and Theatre and all of the items for each category go under these parents.

Movies
    Apocalypse Now
    Magnolia
    ...
Television
    Six Feet Under
    Twin Peaks
    ...
Theatre
    Waiting for Godot
    Uncle Vanya
    ...

Then you create a Page Reference field "Roles" using the Page Autocomplete inputfield and add it to your actor template. You can easily divide the roles by category when you output the roles in your template file. You might like to try the Connect Page Fields module too - I even used the example of actors in the readme. :-)

For the awards field, I think I would stick to a repeater. Each repeater could consist of just a text field for entering the award name, or if there are certain awards that are given out each year you could use a Page Reference field to select the award and an integer field to enter the year.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...