Jump to content

Search the Community

Showing results for tags 'repeater'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Greetings from germany, i develop a shop for a customer and wanted to give them the opportunity to find products without any images so they could easily fill this empty sites. The problem is, that this images are placed inside a repeater. So the structure for the repeater field is: title bild (where 1 image can be placed) bildrecht (another repeater for placing the copyright text) But here comes my problem. I designed a selector that should show me all sites where the repeater count is 0. Like : template=sorte|artikel,bilderrepeater.count=0 But it also shows me results, where the repeater count is still 1 or even greater. If i save one of these bad results, the selector works fine. Is there a way around it ? I use pw 3.0.76.
  2. Hy, I cannot get it going. I try to update a repeater field, containing username, email, a int value, a addresse and a description. I post the data to a handlerfile. So far so good. But how can I save the data to the field? The Pages is under home and contains a repeater_field named multi_locations -> this should be updated. My try so far: if ($input->post) { // $p = new Page(); // $p->of(false); // $p->parent = $pages->get(1); // $p->template = $pages->get('probleme'); var_dump($p); $melder = $sanitizer->text($input->post->melder); $email = $sanitizer->email($input->post->email); $location = $sanitizer->text($input->post->location); $urgency = $sanitizer->selectorValue($input->post->inlineRadioOptions); $description = $sanitizer->text($input->post->description); echo $melder . "| " . $email . "| " . $location . "| " . $urgency . "| " . $description; $p->multi_locations->title = "tryout"; $p->multi_locations->melder = $melder; $p->multi_locations->mailadresse = $email; $p->multi_locations->map->address = $location; $p->multi_locations->urgency = $urgency; $p->multi_locations->beschreibung = $description; //$p->save(); Please help me bring some light into the dark. Thank you in advance!
  3. Hello, I would like to prevent future editing of a repeater item once a checkbox in the repeater item has been checked. Either the form inputs of the repeater item should be read only or only the field values should be rendered. Looking at the module code I can't seem to figure out where to hook for that functionality. Any ideas would be much appreciated.
  4. Hi guys, I'd really appreciate some help from you. I am wondering how I would about using the Selector field type within a repeater. It seems kinda bad design to have multiple selectors (e.g. Grid 1, Grid 2, Grid 3) when I could use a repeater for it. Using Ryan's example, I have managed to get my repeater to work foreach($page->grid_repeater as $grids) { echo "<h2>{$grids->grid_type}</h2><p>"; echo " }
  5. hey there, i have a collection (parent page) of persons (child pages of 'collection'). each person has several fields. two of them are repeater fields where the person can enter their 'jobs' and 'recidencies'. i'm trying to build a list of entries which looks like: Actor Peter Maria Paul … Doctor Eva Julia William … for the first 5 persons everything worked smoothly. but now that i've reached about 20 entries the server slows down and i'm wondering if my loop is somehow cluttred up. <?php $langname = $user->language->title; //get current user language?> <?php $persons = $pages->get('/collection')->children->filter("lang=$langname") // get all children for current user language ?> <section class="profession"> <h1>professions</h1> <?php foreach ($persons as $child): ?> <?php foreach ($child->professions as $profession): // the repeaterfield is called: professions, the field itself is profession?> <?php $profAll[] = $profession->profession // store all entries; $profUnique = array_unique($profAll) // only unique entries ; sort($profUnique) // sort the entries; ?> <?php endforeach; ?> <?php endforeach; ?> <ul style="column-count: 2;"> <?php foreach ($profUnique as $profLetter): // loop through all professions ?> <li style="font-size: 2rem; list-style-type: none;" class="letter"><?= $profLetter // output one profession e.g. Actor?></li> <?php foreach ($persons->find("professions.profession=$profLetter")->sort('givenname') as $person): // find all persons who have the profession Actor ?> <li><a class="ajax" href="<?= $person->url ?>"><?= $person->givenname // output the name of person who fits the profession ?></a></li> <?php endforeach; ?> <?php endforeach; ?> </ul> </section> is there a way to make this request faster? (i'll have at least two of them on the same page)
  6. Found myself needing to filter repeater items based upon start and end date fields. These fields aren't required, so repeater items with no dates should be included and those with dates (or a just one date -- start or end) should be evaluated for inclusion. I slowly figured out that I was dealing with in-memory filtering (of a RepeaterPageArray) and not a database-driven operation. So, that eliminated the possibility of using or-groups in my selector. I still thought I could use the 'filter' and 'not' functions to get the job done. Turns out the way selectors are handled for in-memory filtering is quite different from database-driven selectors. Here is what I want(ed) to do to filter the dates: // Start date not specified or in the past $repeater->filter('start_time<='.$now); // Not when end date is specified and has passed $repeater->not('end_time>0, end_time<'.$now); The first one worked exactly as expected. The second it where I ran into problems. The 'filter' function (which calls the 'filterData' function) takes a $selector argument. From everything I read about selectors, I assumed that the entire selector would have to match. In other words, each comma represented an 'and' scenario. Turns out that each separate comma-separated-selector in the $selector as a whole gets evaluated independently. In the case of the 'filterData' function, the elements are removed if any one of those selectors matches. Essentially, we have an 'or' scenario instead of an 'and' scenario. In my case above, there was no way for me to filter for a non-empty date AND one that occurs before a given date...at least that I could think of. So, my main question is if the filter (and related) function should operate on the entire selector passed to the function instead of its individual parts in some sequence. That is what I would have assumed a selector to do. In my project, altering the segment of the WireArray::filterData function solved my problem for now. ...at least till I forget about it and overwrite it when I upgrade next. Here is the code I changed within the function // now filter the data according to the selectors that remain foreach($this->data as $key => $item) { $filter_item = true; foreach($selectors as $selector) { if(is_array($selector->field)) { $value = array(); foreach($selector->field as $field) $value[] = (string) $this->getItemPropertyValue($item, $field); } else { $value = (string) $this->getItemPropertyValue($item, $selector->field); } if($not === $selector->matches($value)) continue; $filter_item = false; break; } if($filter_item && isset($this->data[$key])) { $this->trackRemove($this->data[$key], $key); unset($this->data[$key]); } } I would love to hear what you all think. If I have misunderstood something, then I would welcome a different solution. Thanks!
  7. hey there, i'm quite new to processwire but i'm having a great experience using it! right now i hit a point where i can't help myself out with google/searchfunction. to sketch the basic functions of my page: visitors can enter their e-mail in a form. when doing this pw creates a new page, using the e-mail's md5 hash as a name. the url of the page is sent to the user. the user now can edit the newly created page and can fill out fields like: name and year of birth (thanks to the docs those two already work like a charm!) but there are other fields like "residencies", which are repeaterfields containing three fields: city (text), country (text), current (checkbox). at my current version i can populate a new repeater field easily by using this code: $location = $page->locations->getNew(); $location->location = Munich; $location->country = Germany; $location->current = 1; $location->save(); $page->locations->add($location); now i want to populate the new reapter fields from input fields (using the simple form api). which leads me to my questions: 1. can i somehow group/merge input fields to one "repeater input fields" right now i have: // create a text input -> locations $field = $modules->get("InputfieldText"); $field->label = __('City'); $field->attr('id+name','location'); $field->required = 1; $form->append($field); // append the field to the form // create a text input -> country $field = $modules->get("InputfieldText"); $field->label = __('Country'); $field->attr('id+name','country'); $field->required = 1; $form->append($field); // append the field to the form // create a checkbox -> locations $field = $this->modules->get('InputfieldCheckbox'); $field->attr('name', 'location_current'); $field->attr('autocheck', 1); $field->attr('uncheckedValue', 0); $field->attr('checkedValue', 1); $field->attr('value', $this->fname); $form->append($field); // append the field to the form 2. my desired layout for the form looks like this: by hitting the + button a new line shows. i'm wondering what's the best practice here. can is somehow use the above mentioned code itself as a repeater, or do i have to create several (uniqe) input fields in advance and hide them afterwards (javascript)? any help is appreciated! thanks!
  8. Something probably off with my loop, the code below is on my "entries.php" template page, it's outputting the title and description of each entry fine but the repeater fields just repeats the first set of images from entry 1 throughout the loop. <?php // Functions $entries = $page->children; $entry_array = array(); $image_array = array(); foreach ($entries as $entry) { // Define the fields wanted $title = $entry->title; $description = $entry->entry_description; $images = $entry->images; foreach ($images as $image) { $imageUrl = $image->url; // make a thumb version $imageDescription = $image->description; // Build array from repeater $image_array[] = array( 'image_url' => $imageUrl, 'image_description' => $imageDescription, ); } $pageUrl = $entry->httpUrl; // Build the array from the fields $entry_array[] = array( 'title' => $title, 'description' => $description, 'images' => $image_array, 'page_url' => $pageUrl, ); } // Json encode the array $entries = json_encode($entry_array, true); // Dump the data // echo $data; ?>
  9. Hi guys, I created an image field (studio) which can contain up to 30 images. Then I created a repeater field (studioimages) and added the studio field. I added some images to the repeater: Now I loop through the repeater, but I only got the first image or no image: foreach($page->studioImages as $studioImage) { echo "<div class='swiper-slide'> <div class='image-gallery'> <a href='{$studioImage->studio->url}'> <div style='background-image: url({$studioImage->studio->url});'> </div> </a> </div> </div>"; } I also tried "$studioImage->studio->first()->url" and "$studioImage->studio" but nothing works. Can you tell me what is wrong?
  10. hi there i'm new to processwire, please cut me some slack if the answer is already out there.. i am "processwiring" a non-cms page that i made, containing many repeating so called "station"-elements with fields such as date, location, miles, optional links, photo upload etc. they were listed and created via php and stored in an xml file until now: <stations> <station> <date>17.8.2017</date> <location>Exil, Zurich</location> <miles>1234</miles> ... </station> <station> ... </station> </stations> i already created a working repeater field with the needed fields and successfully created the first two elements... but there are many more! what is the easiest and quickest way to batch create new repeater fields with the node element content of my xml file? otherwise i would just have to type the whole sh..t again which i am too damn lazy to do thanks in advance nuel
  11. I've been trying to figure a way to output the values of several fields within a single repeater using a foreach() without having to reference the name of the fields. Typically, for repeaters, I understand you would do foreach($repeater_field as $afield) { echo $afield->fieldname_a; } pretty straight forward. Anyways, what I'm doing is using a single repeater as just a container for other fields. I've tried using $page->my_repeater->getArray(), then looping through the array, and all sorts of methods, without luck. It seems I must specify the field name for output. For instance, my (single) repeater is set up to hold a few different fields: my_repeater field_a field_b field_c Trying to output it using something like this: foreach($page->my_repeater as $afield) { echo $afield->value; // I'm not wanting to have the reference the field name e.g. use $afield->field_a } Any suggestions?
  12. Is there a module or plugin that is like a repeater but you can choose a template? I want something that let's me: choose a template to get fields from, display these fields like a repeater does add new pages without adding a title or name (this might be achievable using other means like ProcessSetupPageName) delete pages I feel like somebody might have already made a module that does just this, however, I haven't found any. Perhaps there is a way of doing this with a standard repeater that I don't know about.
  13. I have a problem realizing a picture gallery with albums using repeater fields. Here is what I have: - The repeater field 'repeater_gallery' for all the albums - A text field 'album_name' in the repeater for the album name - An image field 'album_images' in the repeater for all the album images Now I'd like to pick a small selection of images (say 4) of ALL albums randomly and present them with their associated album name. How can this be done with the described repeater setup? Or is there a better way to realize such a gallery without repeaters? Thanks in advance for a little help.
  14. My brain is probably just tiring out on me right this moment, I'm hoping that by the time I write out my problem I'll see the way through it. If you're reading this, it didn't work. Structure in question is: Series Page Product pages Page Fields for each product page Some of these fields are repeaters Fields within the repeater I have made an array of page fields so I don't have to keep track of them all as I develop: $listings = $page->children; // grab all the published children of the Series page foreach($listings as $l) { // loop through the children foreach($l->fields as $f) { } // loop through each child's page fields where they have a value set } Then I break down how to handle each type of field: if($f->type == 'FieldtypeFile') { } elseif($f->type == 'FieldtypeDatetime'||$f->name == 'prod_status_pages'||$f->type == 'FieldtypeImage'){ } elseif($f->type == 'FieldtypePage'){ } These are all largely working as expected (though I do have a couple of offset/isset exceptions to clean up...) It's when I get to the repeaters that I run into trouble getting the API calls to work. Just cycling through the fields as above, the output for a FieldtypeRepeater is the ID of the repeater in that field's array. Everything I read suggests I should treat a repeater the same as I would treat a page, which leads me to the following code. elseif($f->type == 'FieldtypeRepeater'){ // Repeaters need special treatment otherwise output is just ID $th .= "<th><b>{$f->label}</b></th>\n"; $trows = ""; // creating an empty variable to build my foreach into foreach($f->fields as $rf){ // looping, I hope, through the fields of the given Repeater ID $trows .= "{$rf->label}: {$f->get($rf)->title} ({$rf->type})<br />\n"; // add an entry to the variable } $rows .= "<td style='padding: 8px 16px; vertical-align: middle;'>".$trows."<br />\n ({$f->type})</td>\n"; // back out to rendering the Repeater field } What I would hope would output in the HTML I've been building is something like: <td style='...'>Lo temp: -40 (Integer)<br /> Hi temp: 75 (Integer)<br /> Storage Lo: -40 (Integer)<br /> Storage Hi: 85 (Integer)<br /> Functional to: 85 (Integer)<br /> (FieldtypeRepeater)</td> So what I'm trying to do here is loop through the populated fields in the unknown Repeater field, and output them as a simple (so far) text list of the repeater.field and its value (and then its type for my reference). I'm afraid typing this out has fixed some syntax but not enough to get this working as I'd hoped. Please note not all Repeater fields are integers. Some also have floats, files, or options, and probably a couple others I'm forgetting. I appreciate your time in taking a look at this!
  15. Hey awesome PW-Community, I've some strange behaviour in my latest project and I don't know how to get on top of it: I added a repeater field to the User-template. In my project I create a new user than assign items to the repeater. This works perfect, if the new user has the role "superuser" but if I create a new role (even if assign that role all permissions possible), I can't add items to the repeater via the api. I even checked the permissions of the repeater and assigned all permissions to the newly created role. There are also no error logs, even though it seems like the creation of a new repeater element fails. Thanks in advance for your help!
  16. Done quite a bit of Googling and haven't quite worked out how one would create a field of type repeater and add fields to it via the API in a module. Anyone have any links or examples?
  17. wihtin a repeater field (composers) i am using a second nested repeater field (works). For the first repeater item labels show up correctly as defined in the "details" Tab ( "#n: {lastname}" ). The second (sub) repeater constantly displays the label of the repeater field itself ("works") as labels of the items ( ignoring my user definition "#n: {work_title}" ). All items of the nested repeater are labeled in the same way ("works") Is it a bug or have i misunderstood anything? EDIT: meanwhile i found an identical issue reported on https://github.com/processwire/processwire-issues/issues/173 seems to be a bug, a possible workaround can be found in the link
  18. Hello, on a fresh 3.0.62 install I have a page reference field 'mypages' with these settings for selectable pages: In my site/ready.php I have this hook: /** * custom page select */ wire()->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name != 'mypages') return; $pages = new PageArray(); $pages->add($this->pages->get(1)); $ids = $pages->explode('id'); $event->return = $event->pages->getById($ids); }); On a normal page, the hook is working and the mypages field has only 'Home' in the select dropdown . But when I put the mypages field inside a repeater, it is not working. I have this problem on a project that is in development right now and have spent quite some time to try and find the reason. Then I made a fresh PW install to verify the behavior. No matter if repeater dynamic loading is on or off, the page reference field always returns the set of pages defined by the settings in the page reference field. The hook is ignored. Can anyone please verify this and let me know so I can file a bug report. Also if you have an idea how to fix this, I would be happy.
  19. I'm having trouble with sorting by repeater count. We have awards given to each work and the awards are in a repeater. Doing "sort=-awards.count" However it isn't working. Anyone got any ideas?
  20. I used Profields: repeater Matrix to create a field. One of the repeater matrix types contains a repeater field. As a superuser I can create new entries within the nested repeater field. Any user that does not have superuser access cannot create new entries or expand existing entries. When a non-superadmin tries, the following JQuery error can be seen in the console: Uncaught Error: Syntax error, unrecognized expression: {"error":false,"message":"The requested process does not exist"}. “Repeater item visibility in editor” and “Repeater dynamic loading (AJAX) in editor” options are set to the default entries. I am using ProcessWire 3.0.62 and Profields Repeater Matrix 0.0.4
  21. Hello, To compare repeater items when someone added or removed items to/from the repeater, I use this hook wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments[0]; if($page->isChanged('repeater')) { //get page before changes : https://processwire.com/talk/topic/9734-determine-old-vs-new-value-of-field-when-saving/?do=findComment&comment=106166 $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache 'getOne' => true, // return a Page instead of a PageArray )); bardump("new count: {$page->repeater->count}"); bardump("old count: {$oldPage->repeater->count}"); } }); When I add a repeater item, both counts are identical. But they shouldn't. When I remove a repeater item, the counts come out correct. I verified this behavior on a blank PW 3.0.62 install. So I think it is a bug. Can someone please check if they find the same behavior? Thank you. I also tried it with this hook wire()->addHookAfter('Page(template=basic-page)::changed(repeater)', function($event) { // old value bardump($event->arguments[1]->count); // new value bardump($event->arguments[2]->count); }); Same outcome. For the second hook to fire, you need to adjust line 1005 in wire/core/Wire.php to read if(($hooks && $hooks->isHooked('changed()')) || !$hooks) { because of this bug.
  22. Hi everyone I've started to build a newsfeed for a customer, but I'm stuck... I have a news-repeater field including date, title, text and images. I have the link (showing date and title) to each news on the left (with foreach) and the details on the right (showing date, title, text and images also with foreach). I would love to only show the current news on the right. The latest news should be visible on the right. When I click on the link on the left side, it should change the news content on the right side. Does anyone have a simple solution for this? Here's how it looks like at the moment: http://rolspace.net/hd/energiegossau/uber-uns/news/ Thank you! Roli
  23. Following the example from the PW docs I set up a a repeater. I'm trying to fetch random fields from a repeater, for instance, display 4 random customer testimonials. Here is the basic setup in PW: created these fields: testimonial_text testimonial_name I then added them to a repeater field called: testimonials_repeater Next I added testimonials_repeater to a template called testimonials Last, I created a new page called Testimonials using the testimonials template. As far as fetching all the testimonials I'm doing this: <?php $testimonials = $pages->find("template=testimonials"); foreach($testimonials as $trepeater) { foreach($trepeater->testimonials_repeater as $t) { echo $t->testimonial_text . ' -' . $t->testimonial_name; }} ?> Could some please give me some guidance on how to pull, for instance, 4 random testimonials? I mean, I could stick the results in an array[] inside the foreach loops, then random sort the array, then output only 4, but there has to be a better way using PW. Also, is there a way to limit the number of records (customer testimonials) that can be added by the user? Repeaters just always seem to trip me up. :/ thanks much!
  24. Hi, I am creating a template that have two repeater fields: - One for "slideshows" images, other for "highlights" images The field "slideshows" has a "slideshow_images" field (image type) to be repeated and the fields "highlights" should have the field "highlights_images" field (image type) to be repeated. What is happening is when I add the the "slideshow_images" to the field "slideshows" the field "slideshow_images" is also added to the field "highlights" and if I had the field "highlights_images" to the "highlights" field the "slideshow_images" in the field "slideshows" is replaced by the "highlights_images" field. I already deleted all fields and create from scratch and the result is always the same. I am using the Processwire 3.0.39. Can anyone explain what is happening? Thank you
  25. Hi, when i use nested repeater in PW 3 it will only output the first entry from the second repeater. Code: <?php foreach ($page->first_rep as $c): ?> <?php echo $c->fields; ?> <?php foreach ($c->second_rep as $p): ?> <?php echo $p->fields; ?> <?php endforeach; ?> <?php endforeach; ?> Can anybody help me?
×
×
  • Create New...