Jump to content

bernhard

Members
  • Posts

    6,671
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by bernhard

  1. Yep. Perfect solution ?
  2. Doesn't that need to generate the md5 hash of the file on every request (if not cached)? I guess filemtime() is a lot faster than md5_file()?
  3. Thx, updated readme
  4. Developing custom fields for ProcessWire is great! And it's easier than many might think once you get the basic concepts. But it's hard to learn those concepts by reading the code and doing some trial and error... That's why I think we need a good tutorial about that topic. It took me quite long, but now I feel knowledgeable enough to write such a tutorial. I also have the idea (or the need) for some new fields that might be helpful to the community. What I don't have is time ? So I thought to share the workload and share my knowledge while the development of the module (and testing, writing docs, etc) could be done by someone else under my supervision (hope that does not sound scary ? ). What do you think? I'm happy to hear your opinions - we are in the PUB ? Have a great week and happy coding!
  5. How does wordpress do this? You could also do a regular PW installation and add a folder "static" in the root directory. Then you could serve all files that are in this directory via custom htaccess rules (not an expert here ? ). eg /static/foo.html would be served when example.com/foo is requested and /static/bar.html instead of example.com/bar
  6. Thx for the report - always nice to hear that it does not only work for me ? You should definitely take a look at the quite new migrate() method that lets you create fields, templates and pages via simple array syntax ? I'm using this in every module now and it saves me so much time ? /** * Setup this module */ public function setup() { $this->rm->migrate([ 'fields' => [ 'field_done' => [ 'type' => 'textarea', ], ], 'templates' => [ 'template_triggers' => [ 'fields' => ['title'], 'icon' => 'database', 'noParents' => -1, // only one 'childTemplates' => ['template_trigger'], 'noChildren' => 1, // we don't allow pages to be created via backend 'sortfield' => '-created', 'tags' => 'RockTrigger', ], 'template_trigger' => [ 'fields' => [ 'title', 'field_done', ], 'icon' => 'bolt', 'noChildren' => 1, 'parentTemplates' => ['template_triggers'], 'pageClass' => '\RockTrigger\TriggerPage', 'noSettings' => 1, 'tags' => 'RockTrigger', ], ], 'pages' => [ 'rocktriggers' => [ 'title' => "Triggers", 'template' => 'template_triggers', 'parent' => 1, 'status' => ['hidden', 'locked'], ], ], ]); } PS: In my project this setup() method is triggerd on every modules refresh. Maybe a little overhead but for now the easiest option...
  7. Sorry, then I need to change my answer ? You have: Storage (via API) Selectors You need to reinvent: Access Control Forms (showing errors, restoring values, things like showIf, hide fields, lock fields, etc) Sanitization (Fields are sanitized automatically on the backend based on their type) File Uploads etc etc... Basically everything the PW backend provides ? But it's definitely doable on the frontend as well ?
  8. Hi Roli, welcome to the forum! Sure! You have everything you need: Access Control, Forms, Storage (Pages), Selectors (for finding Pages) and finally ProcessModules for creating custom backend "views" for your users: Though I have to admit that it can be a little frightening to work with the PW backend at first. You need to dig into the code and get an idea of how PW works... What is an Inputfield? What is a Fieldtype? What is a Page? What is a HookEvent? etc... It depends a lot on your skills...
  9. Thx ? Please not the statement that I added later ?
  10. Maybe @dotnetic can elaborate why this is a bad practice? @dotnetic any comment on this? PS: Maybe you could link to that post in your language pack's readme ?
  11. Hi @MilenKo glad you got it working. Do you think the readme could be improved? Would be nice to get a suggestion of how I could make it more obvious. ?
  12. Maybe @dotnetic can elaborate why this is a bad practice?
  13. Not many... https://github.com/processwire/processwire/graphs/contributors Unfortunately this does not apply to the Pro modules like ProCache ? I don't know what would happen to them in case...
  14. Hi @apeisa do you have any more details on this. Would be interested in your workflows ?
  15. All you need to do is to bring all the knowledge from this thread together and open a request at github: https://github.com/processwire/processwire-requests/issues You don't need to do any git magic there. Just plain text descriptions ? I'm not sure if that is more a request or on issue... Issues are filed here: https://github.com/processwire/processwire-issues/issues/new
  16. I found the reason for this: I'm rendering a repeater with several blocks. There are two subscription blocks with nette forms. A form submit triggers the redirect but the redirect does not happen immediately because it does finish() the active process, hence renders the other blocks as well. That's why I got 2 dumps (one for each block). I added a custom instandRedirect method to my repeater blocks: public function instantRedirect($url) { header("Location: $url"); exit(0); }
  17. Sorry @graziano I had to use and install XDebug today and stumbled over this as well. For future reference or others having the same problem this is what worked for me: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9000 }, { "name": "Launch currently open script", "type": "php", "request": "launch", "program": "${file}", "cwd": "${fileDirname}", "port": 9000 } ] } Fortunately VSCode now has a direct link and this file should be created automatically once you click on it: Once the launch.json file exists the panel will change and you will be able to listen for xdebug:
  18. Have you also tried absolute paths? <img src="<?= $config->paths->root ?>"site/templates/pages2pdf/logo.png" alt="" width="700">
  19. $value = "üäö"; // bad values $this->modules->get('TextformatterNormalizeUtf8')->format($value); echo $value; // good values Note that $value is modified by reference. Imho a good utf8 normalization should be built into the core as sanitizer. So it would be great if you came up with a solid solution that we can suggest ryan ?
  20. Thx a lot! Hooking Field::getInputfield might be the solution ?
  21. There's only one single bar. But it's not an AJAX request. I'm submitting the form as regular POST and then doing a session->redirect to a new page. But usually tracy also log's redirected requests (like after page save). Sorry about the ajax confusion! I meant those redirect bars:
  22. Hey @adrian unfortunately I have some very strange issues with the dumps feature ? This is the code I have (using Nette Forms): [...] l('renderMail'); bd('renderMail'); // submit if($form->isSuccess()) { l('success!'); bd('success!'); $session->redirect('thank-you-page'); [...] I have several problems: 1) The bd() calls do only show up in the dumps recorder, not in the regular AJAX bar dump. 2) The dumps recorder shows the entries twice whereas the tracy logs show them only once. The tracy logs should be the correct results, because after the form success I do a session redirect to the thank you page. No idea why things show up twice in the dumps recorder. Of course I have cleared the dumps before submitting the form ? And it's the latest version of tracy from today (4.21.10) Explanation of the dumps recorder: 1) renderMail is called on the initial page view (correct, logs at 18:10:12) 2) renderMail is called when the form was submitted (correct, logs at 18:10:21) 3) success is fired because the form was successfully submitted (correct) 4) send mail is fired correctly 5) 2, 3 and 4 are dumped again (not correct) Here another dump showing timestamps: Any ideas? ? Edit: I checked by sending an email additionally to the "send mail" dump: public function send($message, $contact) { bd("send $message to $contact"); $mail = new WireMail(); $mail->to('foo@bar.com'); $mail->from('foo@bar.com'); $mail->subject("Test @ ".date('d.m.Y H:i:s')); $mail->send(); } The mail was actually sent twice, so it seems that the tracy dump is correct. So what about the tracy log? Shouldn't that also be listed twice then? No idea why that send() call fires twice at all... there is a session redirect that should prevent this ?
  23. Hm.. Maybe ? Could you give me a pointer how and where your feature is implemented? ?
  24. The client side check does also work for me, but someone could trick that check by posting custom data and on the backend the field uses its original settings (from the database). Did you check on the backend or only client-side?
  25. Thx for the info. That sounds strange - it should indeed work. As mentioned I've already moved along and changed my setup, so it's not easy to reproduce this again I'm afraid. If it does not affect others it should be fine ?
×
×
  • Create New...