Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. Best read about categorization in processwire: https://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/
  2. $resizer = $event->object; $filename = $resizer->filename;
  3. You could still create a simple module to implement the functionality without using ready.php. Just replace the hook and the function in the save snippet you linked. Further information about hooks are also to be found here: http://processwire.com/api/hooks/
  4. The ready.php is so nice. No more tons of mini modules just to enhance the admin.
  5. @horst That sounds definitely clumpsy. What about some buttons in the page editor? Put this as is in /site/ready.php: $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event){ $process = $event->object; $form = $event->return; $page = $process->getPage(); // Update to fit your fieldnames $imageFields = array("images"); $multiple = $page->fields->find("name=" . implode($imageFields))->count() > 1; foreach ($imageFields as $field) { if($page->fields->has($field) && $page->editable($field)){ if(wire('input')->post("hook_sort_$field")){ $page->of(false); $page->set($field, $page->get($field)->sort("basename")); $page->save($field); } $button = wire('modules')->get("InputfieldSubmit"); $button->attr("id+name", "hook_sort_$field"); $button->value = __("Bilder Sortieren"); $button->value .= ($multiple ? " (" . $field->get("label|name") . ")" : ""); $button->icon = "sort-alpha-asc"; $button->addClass("ui-priority-secondary"); $form->insertBefore($button, $form->get("id")); } } });
  6. I just never use system resources, but either mamp or a vm. It's just so much more portable and resistant to changes on the host system.
  7. I think replacing files is quicker than enabling multi-language, but in the end it doesn't really matter. The result will most likely be the same.
  8. This is what would need to be in the afterSaveReady function. But keep in mind that this will deny any attempt to sort images in the backend manually. // Get the soon to be saved page object from the given event $page = $event->arguments[0]; // Sample condition and changes if($page->fields->has("images")){ $page->images = $page->images->sort("basename"); // Page will be saved right after this hook, so no need to call save(). // Every other page you load and edit here needs to be saved manually. $this->message("Images have been sorted"); }
  9. Just replace the whole /site/template folder with the files from the beginner template. The should be interchangeable.
  10. The module is working quite nicely, but I cannot click on the file in the backend anymore even though I'm superuser and editor, which I gave download from admin rights. Edit: Would it be possible to look at the ListerPro styling for the field?
  11. You said your urlSegment2 was '6bc', but somehow pages2pdf is searching for just 'bc'. But the version change could also be the culpit.
  12. You can just put the ID of the page in that field. And to clarify the possible confusion. It may be the case you want to redirect to an url, that isn't a page managed by processwire, therefore it's not a page select field from the beginning.
  13. It would be nice to update the system notification settings for the order with other descriptions. With the current translation it's really hard to differ what means what. I'd rather use something like "newest first" or "oldest first", which makes clear which notifications will be above others.
  14. Does updating to the newest stable version (2.6.1) resolve the issue? If not would it be possible to get the full stack trace as the error is probably rooted far earlier in the stack then what the error message is showing. To get the full trace you'd need to add a line at the bottom of the index.php file. Maybe you also need to comment out the other lines, not sure as I haven't tested it. … } catch(Exception $e) { echo $e->getTraceAsString(); //Add this line /* * Formulate error message and send to the error handler * */ if($process) $process->failed($e); $errorMessage = "Exception: " . $e->getMessage() . " (in " . $e->getFile() . " line " . $e->getLine() . ")"; if($config->debug || ($wire && $wire->user && $wire->user->isSuperuser())) $errorMessage .= "\n\n" . $e->getTraceAsString(); trigger_error($errorMessage, E_USER_ERROR); }
  15. Which version of processwire are you running? Also what are your urlSegments settings for that template?
  16. Just add another option to the selector, where you check for cases, where the start is before the searched date and the end is after the searched date. $selector = ""; // Start date inside $selector .= ", range=("; $selector .= "datefrom>=".$input->whitelist("datefrom"); $selector .= ", datefrom<=".$input->whitelist("dateto"); $selector .= ")"; // End date inside $selector .= ", range=("; $selector .= "dateto>=".$input->whitelist("datefrom"); $selector .= ", dateto<=".$input->whitelist("dateto"); $selector .= ")"; // range overspans searchrange $selector .= ", range=("; $selector .= "dateto>=".$input->whitelist("dateto"); $selector .= ", datefrom<=".$input->whitelist("datefrom"); $selector .= ")";
  17. To be able to help we would rather need to see how you resolve those url segments instead of the raw concatenation of the url, which isn't the part that produces the error.
  18. Then your already on the right track with hooking Pages::find or maybe even PageFinder::find.
  19. What exactly do you mean by quick fix? Getting rid of those characters? Getting rid of the html encoding? Removing the ability to add those characters?
  20. How about simply hiding the products, so they are only shown when adding "include=hidden".
  21. Exactly, you could even replace a whole function with hooks. You can read more about this in the docs about hooks.
  22. It very much depends on how the numbers are gathered. Here in Germany we have a saying that states: "Never trust a statistic you didn't forge by yourself". So do your own research. It's useless to go with a most used tool (e.g. wordpress) if it doesn't fit your needs. And nobody does know what you need but yourself. You can always use contributor counts or surveys as guidelines, but taking them for facts is in my honest opinion just stupid. Any single dedicated contributor is worth much more than any 100 contributors that issued/fixed a typo in the code at some time. These numbers aren't more than hints on how well a project is doing.
  23. $this->addHookAfter('Pageimage::size', $this, function(HookEvent $event){ $thumb = $event->return; // Replace thumb file with optimized one. });
  24. The maxlength attribute on textareas is an html5 attribute and the inputfield's implementation is older than html5. It does support maxlength only in conjunction with an fieldtype textarea, which would ensure the max length on the server side.
×
×
  • Create New...