Jump to content

Multiple Fields in One Template


quickjeff
 Share

Recommended Posts

Hi Guys, 

I recently have received a client who has various page layouts. I wanted to give them the ability to simply add their HTML into a body field with CKEditor to allow HTML customization.

However, the client isn't very familiar with HTML.

This has left me to build a template that has multiple of the similar field types.

The thing is, I cannot use the repeater since I cannot repeat lets say an image for repeated item 1 and only body field for repeater item 2.

Therefore, I have to literally add 15 fields for them to totally be able to edit the page without issues.

What are your thoughts on this approach?

Also, I have to name the template according to what it contains, so I was thinking of using numbers instead of words.

Reason being, numbers can describe the amount of title fields, body fields and images.

Therefore something like, 3-3-2.php or three-three-two.php 

I have never run into a situation where the client needed so many fields. I was always able to get around it with repeaters etc. 

Thoughts?

Link to comment
Share on other sites

If I understood correctly, you are trying to get some kind of a content builder. So your client can add a section with copy, then a section with a copy and an image and so on. I suggest you use Repeater Matrix for that. If you cannot afford the subscription, use Page Table from the core. But... just buy Repeater Matrix) There are other ways, but this one's the best.

  • Like 6
  • Thanks 1
Link to comment
Share on other sites

Right, something like this would be good. I may try this approach. Any thoughts on my other approach?

5 hours ago, Ivan Gretsky said:

If I understood correctly, you are trying to get some kind of a content builder. So your client can add a section with copy, then a section with a copy and an image and so on. I suggest you use Repeater Matrix for that. If you cannot afford the subscription, use Page Table from the core. But... just buy Repeater Matrix) There are other ways, but this one's the best.

 

Link to comment
Share on other sites

30 minutes ago, Robin S said:

You can turn Repeater into a kind of poor man's Repeater Matrix by adding all the fields you need to the Repeater, then adding a Page Reference field at the top to select the type of item. Use inputfield dependencies to show/hide inputfields according to what type is selected.

Once again another great use for a brilliant module! I am sure we haven't yet touched the surface of what can be done with it :)

  • Like 1
Link to comment
Share on other sites

10 hours ago, quickjeff said:

Any thoughts on my other approach?

Yes

16 hours ago, quickjeff said:

I wanted to give them the ability to simply add their HTML into a body field with CKEditor to allow HTML customization.

Bad idea, IMHO. I've never heard anything good come out of letting clients dabble in the HTML. Not sure if PageTable Extended can help in your case. I don't think there's any module that will allow you to repeat fields 'unevenly', i.e. in repeater 1, let's repeat title and headline but in repeater 2, let's only body field, etc. Maybe you can use repeaters with some showIf? or inject your own JavaScript and markup to toggle visibility of fields as per need? E.g. tick a box for use this field...will display the field for editing....Just thinking out loud here.

16 hours ago, quickjeff said:

Therefore something like, 3-3-2.php or three-three-two.php 

It might seem like the easy way out, but honestly, will you remember what these mean when you need to edit something in the future? What if you add or remove a field, do you head back to the template file to rename it? I'd be more descriptive in my naming.

Just my 2p.

Edit:

Btw, ProFields will give you both Table and Repeater Matrix. Take your pick!

Also..what Robin said! Inputfield Dependencies!

 

Edit2: I didn't know repeater matrix allows different types of fields in one repeater!

Edited by kongondo
inaccuracy
Link to comment
Share on other sites

1 minute ago, kongondo said:

Facepalm! How long have I been around here for? :-[:-XI didn't know Repeater Matrix allows different types of repeater items in the same repeater! Thanks @Ivan Gretsky!

It's a fantastic way to give editors a way to control page content without mangling things into an RTE. Also, if you happen to have any sites around where you have used PageTable fields for this and feel like an upgrade to RepeaterMatrix, take a look at the one click converter included in AdminActions.

  • Like 5
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...