Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


3fingers last won the day on May 24 2017

3fingers had the most liked content!

Community Reputation

311 Excellent

About 3fingers

  • Rank
    Sr. Member
  • Birthday 04/22/1981

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Turin, Italy

Recent Profile Visitors

4,876 profile views
  1. 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.
  2. Very interesting read. Thanks for sharing!
  3. Thanks @Robin S, I'm going to put on my black ninja belt and solve this puzzle.
  4. 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?
  5. 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!
  6. Thanks Sergio, you've saved my day!
  7. 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!
  8. 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
  9. @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?
  10. @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.
  11. 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!
  12. Ok, sorry I didn't know you knew ( 😀 ). I have no idea why it's not working then....
  13. 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.
  14. 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.
  15. 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 :)
  • Create New...