Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by androbey

  1. You mentioned you are using option 1 from here https://processwire.com/docs/more/multi-site-support/. But if you follow option 1 you would have a separate db for all four sites. What are you doing to have only one db, are you using any module?
  2. Hi @nexuspolaris, with only option 1 you cannot simply edit data for different sites. See note at the disadvantages: But you still have two options (as far as I can tell): Setup a web service for each site (probably requires some effort) Using multi instance feature of ProcessWire (as I would prefer). Have a look at https://processwire.com/blog/posts/multi-instance-pw3/#using-multi-instance-in-pw3 With this feature you can indeed use the PW API.
  3. Great, thank you very much for your tip! This has brought me on the right track: I have now requested a fresh copy from the database (via selector). Previously, a Page object was passed directly, which seemed to be just an instance of the Page class. Now it works!
  4. Hi all, I have once again a probably unique request. For a project I am using a SlimPHP based approach, which is connected to a ProcessWire instance via bootstrapped API. In general this works very well - except when using custom page class methods. Method Page::getTest does not exist or is not callable in this context Am I missing something? Or is this not supported at all? I tested it with both version 3.0.228 and 3.0.227.
  5. I'm not sure I understood your requirements correctly either. Nevertheless, here's a hint, although I'm pretty sure that's not what you meant. I think that currently only applies to CKE. In the editor field under input you have the possibility to select an image field that will be used for drag&drop (does also work for pasting an image from clipboard). (Screenshot only in German right now)
  6. Can you maybe try to use filename property? Single file has as far as I know no path property. $mail->addAttachment($file->filename, $file->name);
  7. @applab I actually encountered a similar problem some time ago. But there is actually a setting option so that the paths can also remain separated. Hopefully this works for you, too. $config->setLocation('templates', $config->path('site') . 'templates-dev/' . $user->name . '/');
  8. Hi @applab, I'm sure some expert has a useful answer (I'm no expert unfortunantely). But have you tried/can you try solution described here?
  9. No, thank you for your help! Much appreciated!
  10. Thank you for your suggestion. I have tried to use an or-group. This also does not work, as the ordering of the or condition in the selector has no effect. So if I use the or group, the selector would return the first page where either condition is met (even if type is not Type1). So there is no weighting (at least I did not find any).
  11. Yes, good spot, you're right. Should be "Equipment2". And you're absolutely right, matching the equipment (without matching both type and equipment) is the fallback. With a little restructuring (above is only simplified structure), I now just use two selectors (better than a loop which checks if there are pages matching a type). //Are there any stores which both match equipment and title? $pages->get("template=store_template, equipment_ref.title='Equipment2', type.title='Type1'"); //If no: "Fallback" selector.. $pages->get("template=store_template, equipment_ref.title='Equipment2'");
  12. Thank you for your suggestion. That would be a ideal solution if there would be a 1 to 1 connection. But unfortunately it's more complex. //would return null (because Store2 has "Type1", but Store2 has no "Equipment2"), so should return Store1 (where Equipment1 is available) $pages->get("template=store_template,equipment_ref.title='Equipment2', type.title='Type1'); Nevermind, probably was a silly request in first place. It works with loops and performance loss is minimal (only small data set).
  13. Condition is/should be attached to store_template pages. So one store could have one entry "Type1" and another store could have multiple types ("Type2", "Type3"). There's no field yet for it, but it could be anything (simple text field, multi select field, page ref...). The condition to search for "Type1" comes from external at runtime, of course. But the more I think about it, the less likely it seems to be a good solution for database level search.
  14. Hello all, once again I have a special request. Also this time I am not sure if there is a better "ProcessWire typical" solution. I want to find exactly one page where the value of a page reference matches the value I am looking for. So far so good: $pages->get("template=store_template,equipment_ref.title='Equipment2') returns "Store-Page 1" (see sample structure below). However, I need the consideration for special cases, when a certain equipment is referenced in multiple "store_templates". If this case occurs, the "correct" store page should be selected based on another condition. E.g. if the condition is "Type1" and the search is for Equipment1, "Store-Page 2" should be returned. If the condition is "Type1" but the search is for Equipment2, "Store-Page 1" should still be returned. However, the different types are text values (not numeric values). So I guess a regular sort parameter on the selector won't work. Is there any chance to solve this without using loops? Simplified structure: Store-Page 1(store_template) - Equipment1 (page ref to equipment_template) - equipment2 - Equipment3 Store page 2 - Equipment1 - Equipment4
  15. Very nice, thank you! This helps me a lot. Just as a side note: As I have multiple options fields on the same page I'd have to add an additional name selector to the input selector ($('input[name="roles[]"][value=1]') of course escaped).
  16. Hi all, I have a rather special problem (at least for me) and did not find a proper way to solve it. On the system user template I have multiple "Options/Checkboxes" fields (multiple selectable values), where each field could have up to 30 options. Now, it would be a lot of work to click many checkboxes, especially when there are a lot of users. What I would like to have is a button (or multiple buttons) next to the field to set default values (e.g. button "Option 1" would select certain fields and button "Option 2" would select even more fields). Default value sets and selectable options are static. Is there any (good) way to accomplish this? Unfortunately there's is no real dependency which default set should be used (if any), so no after save hook or similiar is suitable. It's totally up to the editor which default set should be used on a per user basis. Hope this makes sense.
  17. Hi @benbyf Maybe this module does help you too:
  18. Hi @adrian, first of all, thank you for your support and the Slack enhancement. I think it's a good fit, but noticed that mail support has "disappeared" (so if logging to Slack is enabled, no more mail is sent - the Slack logger replaces the mail dispatch entirely). It's probably nothing anybody else would use, nor that there's any real need for it (besides my imaginations): So here's my suggestion or better my ideas to even further improve your must-have module. I think it would be great, if you could add a new hookable function, let's say /** * Empty hookable function. * Use hook before TracyDebugger:addCustomLogger to add your own logger */ protected function ___addCustomLogger() { //empty on purpose } and call this method right after you currently call the Slack logger. Then you would be able to add your custom logger module (for example) which takes care entirely of logging. Advantages of this approach: Very custom error handlers would be possible (maybe some internal monitoring tools), you could decide when to use which service (e.g. mail on exceptions, Slack message on anything else) and so on (or even use many services to spam you all at once). I tried this approach with a quick and dirty module, which one would have to keep in mind that autoload priority has to be higher than TracyDebuggers' AND to not have TracyDebugger as a module requirement itself. Unfortunately I am still no expert, but it would be nice to hear your feedback on this.
  19. Hi @adrian, thanks for your fast response. Super nice to hear it's on your list. I agree, a throttle (or an option to throttle) would still be important. But for dedicated and muted "monitoring" channels maybe not that much contrary to mail inbox.
  20. Hi, I don't know if this is the right place to ask this, but I hope so. Tracy Debugger is of course excellent and a must have for each site. Right now I am using the "email notification" feature, but with Tracy's "email-sent"-flag I'd have to manually check the log file, if some error ocurred in the meantime. I was wondering if there is any possibility to add an additional logger besides the log file, which has no "throttle", e.g. something like a Slack logger (https://tracy.nette.org/en/recipes#toc-custom-logger) (without the need to adjust the module myself). Hope this makes sense. Thanks in advance!
  21. I can give you a simple example how to use the options array. In this example you would get all log entries for your log file that have been stored today. $entries = $log->getEntries("simplecontactform-log", ["dateFrom" => "2022-06-14 00:00", "dateTo" => "2022-06-14 23:59:59"]); foreach($entries as $entry){ //get log entry text, you can also get date, user and url $text = $entry["text"]; }
  22. @Flashmaster82 Have a look at the documentation for the getEntries() method here: https://processwire.com/api/ref/wire-log/get-entries/ You have the ability to specify an options array, where you can limit the returned entries (e.g. getting only log entries from a certain date onwards).
  23. You are calling information about all logs. What you need instead is described here: https://processwire.com/api/ref/wire-log/get-entries/ or https://processwire.com/api/ref/wire-log/get-lines/ In your case e.g.: <?php $myLogs = $logs->getLines("simplecontactform-log"); //do stuff with single lines (inside $myLogs array)..
  24. Hi @BitPoet, thank you, this helped and fixed my problem.
  25. Hi @BitPoet, thanks for your help. Calling $modules->get('myfieldtype') does the trick (although it's a little cumbersome to add it everywhere before I'm using this fieldtype via the API). However, I don't understand your second suggestion. Event and EventArray are classes which extend WireData/WireArray, how could they be autoloaded? Setting autoload to true in both FieldtypeEvents and InputfieldEvents (just to make sure) has no positive effect.
  • Create New...