Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by 3fingers

  1. Hi @Robin S, I've sent you a PM, let me know, thanks.
  2. Hi @bernhard, thanks for the module, I'm trying to get my head around. I have this : $matches = $rockfinder->find($selector)->addColumns(['title','image','variante_prodotto.lunghezza'])->getRows(); // Doesn't work 'variante_prodotto' is a ProField of type table and has a subfield 'lunghezza'. How could I retrieve the value of 'lunghezza' using your module? ?
  3. Here you can find all the information you need to do so (aka saving form submission to pages and related fields). https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ And here a very nice module to create a dashboard for processwire (read through the docs to find a way to present your form submissions/pages straight in the homepage of the backend). https://processwire.com/talk/topic/22847-processwire-dashboard/
  4. Same as above, inverting the logic: <?php foreach($page->works as $item) { if($item->is(Page::statusUnpublished)) { // do whatever }; continue; }
  5. if ($child->id === $pid ) { $class= 'active'; // Why are you declaring it here for the 2nd time? } elseif ($template= "memorials" && $child->id === $parents ) { // $template == ... missing double equal sign btw $class= 'active'; } I think you get Undefined because you are overwriting class after the first declaration and then sometimes your if statements never run (depending on false conditions) and so $class is not set at that point.
  6. Very interesting read. Thanks for sharing!
  7. Thanks @Robin S, I'm going to put on my black ninja belt and solve this puzzle.
  8. Thanks @Robin S, I'm trying to get my head around it. if ($input->get->lunghezze) { $lunghezza = $sanitizer->selectorValue($input->get->lunghezze); $input->whitelist->lunghezze = $lunghezza; $tolleranza = ($percentuale / 100) * $lunghezza; $val_up = floor($lunghezza + $tolleranza); $val_down = floor($lunghezza - $tolleranza); //SORT DELTA UP $lun_unsorted_up = $pages->find("variante_prodotto.lunghezza>=$lunghezza,variante_prodotto.lunghezza<=$val_up"); foreach($lun_unsorted_up as $lun){ $lun->delta = abs($lun->variante_prodotto[0]->lunghezza - $lunghezza); } $lun_sorted_up = $lun_unsorted_up->sort('delta'); //SORT DELTA DOWN $lun_unsorted_down = $pages->find("variante_prodotto.lunghezza<=$lunghezza,variante_prodotto.lunghezza>=$val_down"); foreach($lun_unsorted_down as $lun){ $lun->delta = abs($lun->variante_prodotto[0]->lunghezza - $lunghezza); } $lun_sorted_down = $lun_unsorted_down->sort('delta'); } I have more input->get variables, and I'm applying the same concept. At a point in time I "join" all the array I get like this: $insieme = $pages->find("id=$lun_sorted_up|$lun_sorted_down"); // and so on... All good...but, if i put a "limit=20" to the selector (for pagination): $insieme = $pages->find("id=$matches|$lun_sorted_up|$lun_sorted_down, limit=20"); The sorting order is completely gone! Why?
  9. Hey all, I'm facing a problem way over my knowledge right now. Big problem and tight deadline :( Basically is this: $percentuale = 20; // percentace if ($input->get->lunghezze) { $lunghezza = $sanitizer->selectorValue($input->get->lunghezze); $input->whitelist->lunghezze = $lunghezza; $tolleranza = ($percentuale / 100) * $lunghezza; // calculating the tolerance $val_up = floor($lunghezza + $tolleranza); // tolerance up $val_down = floor($lunghezza - $tolleranza); // tolerance down $selector .= "variante_prodotto.lunghezza=$lunghezza, "; $tolerance .= "variante_prodotto.lunghezza>=$val_down, "; $tolerance .= "variante_prodotto.lunghezza<=$val_up, "; } $tolerance .= "template=prodotto_alimentare, sort=variante_prodotto.lunghezza"; /* I want to sort the result from the closest to $lunghezza, but now they are sorted by the smallest to the greatest. */ $matches = $pages->find($selector); $with_tolerance = $pages->find($tolerance); $insieme = $pages->find("id=$matches|$with_tolerance"); foreach($insieme as $product) { //etc... } I'm outputting a series of product which has a particular length ($lunghezza) and also other products which are contained inside a particular tolerance ($with_tolerance). How can i sort the results ($insieme) from the closest to $lunghezza onwards? Right now they are sorted by the smallest to the greatest. Hope to have some feedback from you. Thanks!
  10. And this particular post it's the key to success ? Here's the solution: if ($input->get->forme_options) { $san_array = array(); foreach ($input->get->forme_options as $forma) { $san = $sanitizer->selectorValue($forma); $san_array[] = $san; $selector .= "forma_prodotto.title=$san, "; } $input->whitelist('forme_options', $san_array); } My Lord, that was hard! (at least for me :)). Thanks!
  11. Thanks @Sergio but I don't think my problem is related to pagination, infact it works correctly on my side. I think it's rather something to do with whitelist on multiple checkbox (eg. forme_options[] ) which I cannot get it works. Also take a look at my url in my last post above: %5B%5D // I think it's [] encoded, but then it get lost on subsequent pages
  12. @Jan Romero Got success for single values but still have troubles with multi-selection choices (such as checkboxes). I'm trying to solve this way, but without success: // In the code for the form foreach($forme_options as $key => $value) { echo "<li class='icons'><input type='checkbox' name='forme_options[]' value='$value' id='ico-$value'><label for='ico-$value'><img src='{$images->eq($i)->url}'/></label></li>"; $i++; } // Later in the logic if ($input->get->forme_options) { $forma = $sanitizer->selectorValue($input->get->forme_options); $input->whitelist->forme_options = $forma; foreach ($input->get->forme_options as $forma) { $selector .= "forma_prodotto.title=$forma, "; } } In the first page of the result I got this GET query back and results are correct: myurl/?forme_options%5B%5D=rettangolare on the second page (and onwards) i GET this, but the query is lost: myurl/page2?forme_options=rettangolare which looks kinda right, but...no. ? Sorry but this is my first "complex" search form with processwire and I'm not really an expert with this. Any clue?
  13. @Jan Romero Just here to say thanks for your detailed answer, is such amazing how much this community surprises me even after years. I'm going to test your suggestion tomorrow at office time, and be back here to mark (hopefully) solved this thread. Thanks again, really really appreciated your effort.
  14. Hey all, I know about $input->whitelist and tried all my way down to solve this problem. Basically the query string get lost in some way on the 2nd and subsequent pages I get this url: myurl/page2?q=WireInputData My eyes and brain got a twist and cannot go further. I post my code in here, if somebody would like to help me figuring it out: Here the form Here the logic Many thanks!
  15. Ok, sorry I didn't know you knew ( ? ). I have no idea why it's not working then....
  16. On the same page you've linked: https://processwire.com/blog/posts/pw-3.0.142/#how-to-setup-and-use-custom-fields-in-file-image-fields basically the "trick" is to use a template without a file named matching the name of your image/s field (eg. field-images where "images" is the name of your image field). Ryan explains it way better in the post btw.
  17. You should check this module: https://processwire.com/talk/topic/11499-admin-restrict-branch but personally I would create a front-end editing per-user page with the necessary form for image and video upload. I don't want users (rather than admins or editors) to access the backend.
  18. Just here to say that I'm the kind of person whom prefer to learn by watching videos, so it would be great if someone could create a series about this topic :)
  19. For some edgy situations where I cannot solve with just appropriate media queries logic I tend to use Mobile Detect, which uses the user agent string to determine the device in use. One use case for me was the need to swap an html5 <video> with a jpg on iOS devices, due to the fact that I could not autoplay on those devices.
  20. Thanks @adrian and @itsberni, now it's clear what you are doing, thanks for the explanation ? Nice gem from an old blog post too @Jan Romero, I remember I read it once it was published but I forgot it completely. There is so much knowledge "hidden" in the blog which is missing from the docs unfortunately.
  21. Glad you sorted out! But I still don't get the logic where $user->id could match $page->entryPages->id, now I'm the one asking for help ? Maybe @adrian could enlighten my tired brain? ?
  22. This comparison, written like this, shoud never return true: if( $user->id == $page->entryPages ) How could a user id match another page id? Are you trying to check if a particular user is the one who created the page you are checking against? In this case you could use $pageToCheck->createdUser where $pageToCheck is your $page->entryPages (still think this is a WireArray and need to be traversed before).
  23. Yes, edited right before your answer ?
  24. What kind of field is "entryPages"? I suppose an integer field due to the fact you're comparing with the user->id. And in which situation a user would write inside that field an exact id? ...or, entryPages is a page reference filed, but since it's plural you are dealing with an array of pages, so comparing a single id with an array would never match?
  • Create New...