Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

51 Excellent

About chrizz

  • Rank
    Sr. Member

Profile Information

  • Gender
  • Location
    Berlin, Germany

Recent Profile Visitors

3,625 profile views
  1. whoop. Perfect! Thanks for that link
  2. I already checked the CaptainHook cheatsheet - only the httpUrl method for PageFiles is hookable. It looks as if hooking the counterpart for pages is not possible I currently use httpUrl at many places in the code but the URLs need to be rewritten. When hooks are not appropriate: Is there a way to add a custom method for all pages (e.g. $page->myCustomPath()) which actually returns the URL I need?
  3. nahhh.... I found the issue. If I would have followed @LostKobrakai advice: serialize can cause unforseen issues. The above example works fine, but actually (and I didn't test this yesterday) I (un-)serialize the array before replacing one item. When I use the example and serialize WireArray before getting and replacing the element it simply does nothing but it shows the old item I guess I have to go with the "use pages for every item" solution which is much less error prone. thanks @kongondo for testing this
  4. I have a WireArray which holds objects of type WireData. I use WireArray because I would like to utilize the capabilities of using selectors to find items. My current use case is to find one specific item, modify one value and put it back to the WireArray. The code (simplified) looks like this: // fill the array $arr = new WireArray(); $item1 = new WireData(); $item1->text = "lorem ipsum"; $item1->identifier = "123"; $arr->add($item1); $item2 = new WireData(); $item2->text = "lorem ipsum"; $item2->identifier = "456"; $arr->add($item2); $item3 = new WireData(); $item3->text = "lorem ipsum"; $item3->identifier = "789"; $arr->add($item3); // use the array $myItem = $arr->get("identifier=456"); $myItem->text = "some other text"; // update the item in the array ? Is there any trick to store the modified item in the array again? Removing the old item does not work because I don't know how to retrieve the key of $myItem Adding the item just duplicates it Replace the old item does not work - it keeps the old item Any help is appreciated! I hope that there is a solution - otherwise I have to replace the whole construct with single pages (which would be overkill) Thanks a lot!
  5. thanks for your input. I think serializing is the way to go for now. The closest pw-way would be probably to create new templates holding all the data, but for now this would be overkill
  6. I was wondering if there's a PW-way to store a WireArray permanently in a field and restore the WireArray whenever needed. Currently I can only think of (un)serialize or getArray() and then storing the array as JSON. It there's no better way - fine. If there is something more PW-related, I'd be happy if you share it Thanks!
  7. as usual: Layer8 problem. I just messed up with the field names. It works as expected as shown in the example above.
  8. @LostKobrakai, that was one of my thoughts as well. But I am building a form in a frontend template without any PW javascript (at least I am not aware of that). And because of that I tested if this is probably only a backend functionality in PW admin - but as said: it works as soon as the requiredIf is related to a text field. But anyways: I recognized that the Datetime field has some issues anyway. It's worth fixing them first
  9. I am currently building a form (used in template) which includes a datetime inputfield (date of birth) and a radio input (+some other inputs). What I am trying to achieve without success so far: Based on the datetime input the radio field needs to become required. $field = $this->modules->get("InputfieldDatetime"); $field->label = "DOB"; $field->attr("id+name","date_of_birth"); $field->attr("type","text"); $field->dateInputFormat("d.m.Y"); $field->required = 1; $field->customError = "Birthday missing"; $form->add($field); $field = $this->modules->get("InputfieldRadios"); $field->attr("id+name","confirmation_underage"); $field->attr("type","text"); $field->addClass("validate"); $field->addOption(1,"lorem ipsum"); $field->addOption(2,"lorem ipsum"); $field->required = 1; $field->requiredIf = "date_of_birth>1557180000"; $field->customError = "Missing value!"; $form->add($field); I confirmed by testing, that the requiredif works when it is dependent on a text field (e.g. first name) and the first name matches the condition. I assume that there is something fishy with the unix time stamp in that condition but I didn't find any examples. Printing the field value shows the timestamp (as integer). As usual - any help is appreciated Thanks a lot!
  10. Makes sense. I will have a look at this.
  11. I was wondering if there's a way to select multiple dates in one field, like it's done here: https://codepen.io/ranjith555/pen/OyKjjm Something which goes into the right direction would be this: https://modules.processwire.com/modules/inputfield-recurme/ but this sounds a bit like overkill just just selecting multiple dates. Any ideas are appreciated
  12. Sounds like a pretty nice idea, but in the end I think it does not work, as the structure is a bit more complicated than presented. The whole thing ends up in some kind of Rest API. Static containers are returning a list of user-specific content - therefore Currently I have URLs like this (red = user specific, blue = general path) domain.com/api-v1/container1/custom-content-1/container1-1/custom-content-1-1/ This works perfectly with one user, but as soon as you have a second user the whole thing becomes more tricky. Either the URL would end up like this (which feels weird) domain.com/api-v1/user1/container1/custom-content-1/container1-1/custom-content-1-1/ or permissions are applied to all custom content so that the structure can stay the same as in the first example. Working with permissions here might be replaced with $pages->find() if each user-specific page can be identified. And the final solution has been found here: In the end I will use api-v1/ with URL segments. Based on the authenticated user the segment is passed to $pages->find() link this: if($user->isLoggedin()) { $pages->find("/data/".$user->id."/".$input->urlSegmentStr) }
  13. the overall goal is some kind of API which returns content on an endpoint which is user-specific. container1 and container2 are the endpoints which return such user-dependent content. technically it would be user-n/container2/ - but visible to the user would be only container2/ In a way it's stripping out the /user-n/ part and handle it implicitly via the given authorization.
  14. I am currently thinking about a potential site structure which is based on the authorized user. The currently desired structure in the backend would be something like this: user1 container1 custom-content-1 container2 custom-content-2 custom-content-3 user2 container1 custom-content-1 custom-content-2 container2 custom-content-3 custom-content-4 There are two pages which are common and user-independent: container1 & container2. Everything below these common pages depends on the user. Ideally these pages can be access like this: User 1 can access https://domain.com/container2/ and see's custom-content2 & custom-content3 If user2 access the same URL he would see "his" custom-content3 & custom-content4 Any unauthorized user would get an error message. What do you think about this approach? Do you have better ideas how this can be tackled? While writing: What about merging everything in one container but apply specific rights for every page individually? Is this a scalable solution even with 1000 users?
  15. Sorry for pushing this but I still hope that someone has an idea. Maybe you are using a different IDE? Or you are not testing as all?
  • Create New...