Jump to content

Clone/add existing custom field


muco
 Share

Recommended Posts

Hi guys,

let's assume I'm developing a site (custom theme with custom fields) for my customer, where he can list any articles. For example: Article1 -> item1, item2, item3, item4, etc... Each item is a textfield. 

Now if I want to add a new item, in this example item5, then I have to clone an existing field in the admin panel and also add this field to pagefile with PHP. If there would be 100 items, do I really have to clone an existing field and add this field to PHP code everytime? 

But my main question is: if my customer want's to add a new item (on the admin panel with own user), is there a way that he can clone an existing field (item) and edit the text inside and publish this field on the site, without customizing with PHP?

Link to comment
Share on other sites

9 hours ago, louisstephens said:

You could make use of the repeater field to achieve this. You simply create the repeater and assign it the fields in questions, and the customer could add them quite easily.

https://processwire.com/api/fieldtypes/repeaters/

Example 


<?php
	foreach($page->articles as $article) {
		echo $article->some_field;
	}
?>

 

That is EXACTLY!!!! what I was looking for.. I will test this later. Thank you!

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