Jump to content

androbey

Members
  • Posts

    91
  • Joined

  • Last visited

Posts posted by androbey

  1. Hi @nexuspolaris

    with only option 1 you cannot simply edit data for different sites. See note at the disadvantages: 

    Quote
    • Sites can't easily share data with each other, since they are running independently from one another.

    But you still have two options (as far as I can tell):

  2. 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.

  3. 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)

    image.thumb.png.6cd8684fb3535b87b2e5f2979c5fcf1c.png

  4. 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).

  5. 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'");


     

     

  6. 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).

    • Like 1
  7. 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. 

  8. 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

     

  9. 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.

  10. 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. 

  11. 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!

    • Like 1
  12. 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"];
    }

     

    • Thanks 1
  13. 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...