Search the Community

Showing results for tags 'repeater'.



More search options

  • 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

  • ProDrafts
  • ListerPro
  • ProFields
  • ProCache
  • Form Builder
  • Likes
  • ProDevTools
  • Custom Development

Categories

There are no results to display.


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

Found 169 results

  1. Hi, I have a page with a repeater called teams with two fields: team (a pageReference with a list of teams) and people (a pageReference with a list of people who likes this team). I'm trying to populate the people field in the repeater according to the value of the team field in the same repeater. So far. I'm able to get the pageArray that I want to assign to the people field, but i don't know how to "save" the value for each instance of the repeater. I hope somebody can give me a light. Thanks in advance. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'people') { $repeaterField = $event->arguments('page')->teams; foreach ($repeaterField as $t) { // Is this the way to loop the instances of the repeater? $team = $t->team->id; $t->people = $event->pages->find("template=user, team={$team}"); var_dump($t->people); // This returns the values that i want to assign for each repeate instance $event->return = $t->people; // I hope this assign a custom pageArray for each repeater, but it assigns the same for all the instances of the repeater } } });
  2. Hi My first use of repeaters. They seem very useful, but I'm having a strange problem with the descriptions of the images field. I can't change them after deploying from my local dev server to the live server. I have defined a repeater with one images field and one textarea (multi language) field. This works as expected when added to a template and on the page I add an image and text in 3 languages. I usually populate the image description fields with a caption text in 3 languages so that I can output a caption if required under the image. Now this all works a treat on my test localhost server, but when deployed to the live site the captions cannot be changed on these repeater image fields. If I login to the live site and change the image text in there - as soon as I hit save the text goes back to what it was before! I am logged in as superuser so can't work out what the problem is. I had a search through the forums but couldn't find a similar problem. Any ideas where to look for some clues to what the problem may be? I'm using ProcessWire 3.0.96 Many thanks - Paul
  3. On a site that lists events, I am using a repeater field 'event_time', which contains two Inputfield Time fields 'event_time_start' and 'event_time_end'. Some events take place multiple times, others just once. Here's an example for the data structure: event1 title: First Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event2 title: Second Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event_time (2): event_time_start: 14:00 event_time_end: 18:00 event3 title: Third Event event_time (1): event_time_start: 07:00 event_time_end: 09:30 First, I'd like to generate a list of all events, sorted by event_time_start, with every repeater item added as an actual event (similar to a SQL JOIN clause). The desired output would be: 07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event 14:00-18:00 Second Event A selector like $pages->find('template=event,event_time.event_time_start!=,sort=event_time.event_time_start'); would only return each event page once: 07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event without 14:00-18:00 Second Event Is there a possible alteration of the selector to take all different occurrences into account? Also I'd like to filter for events taking place in the morning, using a selector like: $pages->find('template=event,event_time.event_time_start>=06:00,event_time.event_time_start<=12:00,sort=event_time.event_time_start'); However, this would only return each 'event' page, which then contains also the afternoon version of event2. While I have the impression these are rather simple tasks, I struggle finding a selector-based solution to it. In this example on opening times are some similarities, but it does not deal with multiple occurrences. I'd appreciate your ideas to it.
  4. I have the following page and field setup: root_page (Page) | |- colors_page (Page) | | | |- type_repeater (Repeater Field) | | | |- color_repeater (Repeater Field) | |- colorname_text (Text Field) | |- coloropt_options (Select Options Field / Multiple values) | (1=usable, 2=preferred) | |- products_page (Page) | |- product_repeater (Repeater Field) |- product_color (Page Reference Field) Now i want to fill the entries of the 'product_color'-field with only the color names ('colorname_text'-field) of the colors which are 'usable' (value=1) corresponding to the 'coloropt_options'-field within the nested repeaters 'type_repeater' and 'color_repeater' of the 'colors_page'. I researched and tried a lot, but cant't really get around this problem. As a temporary workaround i replaced the repeater fields by subpages - but that isn't what i want in the end. And now i hope for a helping hand to give me the essential advice or hint. Thanks a lot in advance.
  5. I don't know why multiple instances (repeater_repeat_columns1, repeater_repeat_columns2, ...) of my repeater field are displayed inside Template field (see image). Is there a way to clean/reset it ?
  6. I'm trying to update certain repeater fields with a hook. This almost works, but is somehow buggy. Each repeater is supposed to represent a row: service, remarks, number of days, day-rate, row total. The last repeater should then show the grand total. I've tried this: $this->addHookAfter("Pages::saveReady", function (HookEvent $event) { $page = $event->object->getPage(); if ($page->template->id == 89 && $page->parent->parent->id == 11180) { $repeater = $page->offer_calc_repeater; $itemCount = $repeater->count(); $c = 0; $grandTotal = 0; foreach ($repeater as $rep) { if($c < ($itemCount - 1) ) { if (!empty($rep->days) && !empty($rep->daily_rate)) { $num_days = $rep->days; $day_rate = $rep->daily_rate; $row_total = $num_days * $day_rate; $rep->row_total = $row_total; $grandTotal = $grandTotal + $row_total; $page->save(); unset($num_days); unset($day_rate); unset($row_total); $c++; } } if ($c == $itemCount) { $rep->row_total = $grandTotal; } } } }); Most calculations are correct, but: The first one is empty. The second one is calculated wrong. I've tried typecasting (float), or checking with strlen instead of !empty, but that doesn't make any difference. Is the Pages::saveReady the ideal hook for such stuff? (placed in site/ready.php). Also, I get an error message: Session: Method Pages::getPage does not exist or is not callable in this context. Any ideas? Would you perhaps rather do stuff like this via JS?
  7. louisstephens

    Ill be honest, I am a bit unsure how accomplish this. I have a repeater (dev_repeater) that contains an image field set to 1 image. Nested within this repeater, is another repeater (dev_child_repeater) that allows a user to add in some urls. However, there is also a hidden field that I am trying to pass the parent repeater's image path. I know I can output all the data by using: <?php foreach($page->dev_repeater as $repeater) { foreach($repeater as $url) { # do some stuff } } ?> For the life of me, I can not figure out how to obtain the image url in my php to pass to a variable inside the nested foreach loop. Hopefully this made some sense.
  8. Hi, I have a template that it's working fine in development, however I can't get it to work on production! It shows every information inside repeater fields except the images. Here's the template: These are the circuit_day_image settings: This is the code: <?php foreach($page->circuit_days as $circuit_day) { if($circuit_day->circuit_day_image) { $day_image = $circuit_day->circuit_day_image->size(300, 300)->url; echo '<img src="' . $day_image . '" />'; } else { echo 'No image! :('; } echo '<h2>' . $circuit_day->title . '</h2>'; echo $circuit_day->body; } ?> I always get "No image! :(" I think I'm doing everything right! Anyone else with a similar problem? Update After uploading the production database into my server, the images stopped working. It can be one of two problems: 1. Bad field configuration; 2. Something wrong with the Database. I can't find the problem. Any suggestion is welcome, thanks, Update 2 I forgot to upload the images. It's working on dev and not on production. Still no clue! Clue 1 When I insert <pre><?php print_r($circuit_day); ?></pre> On development I get a clean list for each repetition: However, on production, the command gets on a weird recursive loop that takes forever (it even slows the browser to a halt): What might be going on?
  9. Hello @ all, today I am struggeling with the deletion of empty repeater items after saving in the backend. Explaination: Imagine you are adding an additional repeater item in your form in a page via the "Add button". Then you forget to fill out this item so it is empty. After submitting the form the empty repeater item is still there because you did not deleted it with the basket symbol (deletion) Goal: In theory it must be possible to create a hook that checks the repeater items for content and delete the empty items after saving. At the moment I dont know how to check if an item is empty or not. I know how to delete fields in the repeater item but not the complete item itself. Can anyone point me into the right direction? Best regards
  10. Hi All, maybe a really stupid question, but is there a way to sort repeater items on -created? Like $page->social_activity('limit=10,sort=created'), with 'social_activity' as the repeater field? Tried this but it didnt work Any help appreciated!
  11. Hello there! And thanks for Processwire. Got one more interesting question. One of my templates called goods has two repeaters. The first one is variants, each item containing possible sizes, colors and so on. The second one is available_variants, each item should contain a region and a variant which should be selectable from the list of variants. So the task is to get items of one repeater from inside the page reference field which is the part of another repeater, both repeater belonging to the same page. Processwire gives some options for retrieving selectable pages in this case. We can use: Parent. Not an option because we need dynamic parent being in fact the current page which contains both repeaters. Template. Not an option again because we need to select repeater items not only by template but also by page id which is dynamic. Custom find. Could be a solution but have no idea how to substitute the current page id into ID query. Selector string. It's almost what we need, but again i have no idea how to substitute something like "parent={$parent->id}" in this case. Custom PHP code. This needs to be placed inside site/ready.php and should contain a hook which finds pages using all the power of PW API. Think that the last option is the solution, but could not get the result i need. The simplest possible way seems to use $event->arguments('page')->variants. But it returns nothing. Tried different selectors like "template=repeater_variants, parent=".$event->arguments('page')->id , but still no result. Will be grateful for any help. Thanks in advance!
  12. Hello, I recently posted in this topic, but I decided to start my own thread because while I believe my issue is related to the one in that thread, they are not exactly the same: I have created a custom User Template in the method outlined in the docs. I am creating a directory, so it made sense that every page in the directory was a Directory Member, so they could log in and edit their own information while also keeping the entire directory protected behind a login wall. So the new user type is created: "directory-member". I then created two new roles: "member" and "directory-admin": The "member" only has the ability to View directory-member pages, and "profile-edit", which allows them to manage their own information. The "directory-admin" has the ability to edit any directory-member pages, and administer users. Some Directory Members are both, but all have at least the "member" role. The first hint that something was wrong was when I was testing a "member" user and I could not add a new item to a repeater on that profile. The url for the profile edit (this will be important shortly) is site.dev/admin/profile. The repeater is set up to load new items through AJAX. If this option is turned off, the rest of this issue is no longer completely valid. But as I have found what I believe to be a pretty large issue in the Processwire codebase, I thought it worth bringing up. See, every page (even a user) has a $page->editUrl() method, and it returns a URL like this: site.dev/admin/access/users/edit/?id=2096. That's all good and fine for users that have page-edit permissions, but if they don't, that link will resolve to the admin's equivalent of a 404. So the way that Processwire currently gets around this is by creating a specific editing area for a user to interact with only their profile: /admin/profile. And that works pretty nicely, except for the fact that nowhere is editUrl() ever made aware of the difference. editUrl() is not hookable, and whether or not a page is editable is based on the PagePermissions module. On top of that, there are several core modules that hardcode a search-and-replace (see InputfieldRepeater.module:627) where the editing screen is for Users. This doesn't allow for a huge degree of flexibility that is offered in other places throughout Processwire. If line 627 of InputfieldRepeater is changed from this: $editorUrl = str_replace('/access/users/edit/', '/page/edit/', $editorUrl); to this: $editorUrl = str_replace('/access/users/edit/', '/profile/', $editorUrl); ...the AJAX repeaters work. It's maddening! As is brought up in the thread I attached above, a lot of the features of page editing are missing within /admin/profile/, and it just makes for an altogether strange editing experience. A user who has "page-edit" permissions for templates other than directory-member, but does have "profile-edit" permissions, will see their user in the Page List, but cannot edit their Page unless they hover over the wrench and click the "Profile" link. It just seems - off. I think what this hinges on for me is that the editUrl() of the user should be "/admin/profile/" if that user is logged in (and their page should be editable from the Page List), or the "/admin/access/users/edit/" url; regardless of the URL, both links should resolve to the Page Edit screen, as the Profile Edit screen seems to be a unnecessarily neutered version of Page Edit.
  13. Hi, Whenever I try to create a repeater field on my website, I get following error: General error: 3161 Storage engine MyISAM is disabled (Table creation is disallowed). If I still continue, it creates the field but doesn't allow storing any kind of data. How do I resolve this? Is there any alternative to repeatable content that I can use? Thanks for your time.
  14. nasenfloete

    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!
  15. I have a file I want to access with ajax: The purpose of this file is to iterate through a repeater, and get the image from each entry. The number of images in the image field is set to 1, and just for good measure, to return a single image. And my code: // site/ajax/processImage.ajax.php?group=1206 require_once($_SERVER['DOCUMENT_ROOT'].'/index.php'); $resourceGroup = (int) $_REQUEST['group']; // get the Repeater field $resources = $pages->get($resourceGroup)->resources; foreach ($resources as $resource) { echo $resource->title; // Works as expected echo $resource->image->url; // /site/assets/files/1259/ echo $resource->image; // filename.jpg echo $resource->image->description; // nothing } See comments above for what is output, why isn't URL giving me a full URL, and no description is available? If I try to access $image->size() I get the following fatal error: Error: Uncaught exception 'ProcessWire\WireException' with message 'Method Pageimages::size does not exist or is not callable in this context' in F:\sites\<sitename>\wire\core\Wire.php:519
  16. activestate

    Hi, I'm having problems with seatching for a value in repeater. One of pages have attached repeater called 'insight_repeater'. This repeater has h1_tag (text field) and i'm trying to search for repeater items that contains 'lor' phrase. And right now i'm trying to do simple search, looking for phrase 'lor'. I've tried many approaches, but nothins seems to work, so i want to ask what i'm doing wrong here: <?php $query = $page->get("insight_repeater")->find('h1_tag~=Lor'); ?> Thanks for help.
  17. Hi everyone! Perhaps I'm a bit enthusiastic in using the Repeater-field & FieldsetOpen combo, as I've already posted another question about it today... But here goes nothing I've got a FieldsetTabOpen which I'm using in a Repeater-field, but that's not working as expected; as in – no tabs showing Instead it just shows the two grouped in FieldsetTabOpen below each other...would be great to see tabs in the repeater as well. To add some visuals in; In the attached images the fluor-green box is my repeater, with two checkbox fields, and after that the two FieldsetOpenTab groups. The other two are how I set up the fields in the repeater (Reno AdminTheme) and the current view in the CMS. Any tips/recommendations as to how I could go about setting this up? I've tested the FieldsetOpenTab elsewhere, it works perfectly – but then again, here I'm trying to use it in a Repeater instead of directly in a template....would I need to place the two tabs in a fieldset? Or some other ingenious construction-ideas that could help out here? Hope someone has an idea as to how to do this! Thanks!
  18. Hi, I am working on a processwire project for my college. I created an entire site about a year ago without any problem. Today however, I was making some changes to the site and I was experimenting with duplicating data across multiple pages. There is a repeater on one of the pages that I need to be the same across all pages. I clicked the checkbox to autojoin within the field options for the repeater and processwire crashed. I am not able to make any changes to the page to uncheck and I cannot view the site any longer. This is the message I get on the page. Fatal error: Exception: Could not execute User::__construct() (in /var/www/html/wire/core/Pages.php line 323) #0 /var/www/html/wire/core/Pages.php(323): mysqli_result->fetch_object('User', Array) #1 /var/www/html/wire/core/PagesType.php(101): Pages->getById(Array, Object(Template), 29) #2 /var/www/html/wire/core/Session.php(64): PagesType->get(41) #3 /var/www/html/wire/core/ProcessWire.php(138): Session->__construct() #4 /var/www/html/wire/core/ProcessWire.php(46): ProcessWire->load(Object(Config)) #5 /var/www/html/index.php(185): ProcessWire->__construct(Object(Config)) #6 {main} in /var/www/html/index.php on line 217 I tried to comment out 323 without any luck. I also took a look in the database to see if I could manually turn off the autojoin option. However, I was not able to figure out where the option was located within the database. Any help or suggestions would appreciated. EDIT: I was able to solve the issue on my own. I did a google search and found that I needed to change he flag for the field from 1 to 0 in the database, and everything works again. Here is the post that I found that solved the issue.
  19. Hello fellow Process wire Developers! Today i have encountered an issue using the repeater where I can't find out how to solve it therefore i am asking for help. To be specific, I am trying to get the "file" field working properly in the repeater but i couldn't find a way on how to assign a property of a field that is being used by the repeater. download_pdf is the name of the field that i want to access properties from. What i wished i could do was something like $download->download_pdf.size or $download->download_pdf->name, something like that but obviously these didn't work Hope there is a solution and thanks in advance! Best wishes, Livius
  20. Cloud8888

    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.
  21. 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!
  22. 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.
  23. 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 " }
  24. 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!
  25. 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)