Jump to content

monollonom

Members
  • Posts

    86
  • Joined

  • Last visited

Everything posted by monollonom

  1. Hi, Thank you for your module. Just a suggestion : because I don't have a specific "description" field for the meta tag, I rely on an "about" field which is a CKEditor. Because of a <a> tag within it, there was an issue rendering one of the pages. So on my local copy I used $sanitizer->truncate() on line 134: $this->description = $this->description ?? $this->sanitizer->truncate($this->page->get($this->description_selector), 160, ['type' => 'sentence']); Maybe this could be a valuable addition ?
  2. Thank you for your detailed answer, I'll have a look and come back with the solution (or questions) I'll come up with !
  3. I just started using it on the client project I mentionned a while ago and it's working amazingly, thank you so much for your hard work ! I have one suggestion / request though: could there be a way to add a string at the end of the translation automatically ? Something like "(translated with DeepL)". Ideally as an option per text field ? I'm seeing from the source code that ___executeData() is hookable, would you suggest to go this way ? Editing the returned json ? Thank you in advance for your feedback / help.
  4. I thought my download link in the modules directory was working but apparently it didn't. Maybe because I forgot to create a release ? Anyway the download link should be working fine now.
  5. I made a small update where you can now output the QR Code on the front-end by calling the field directly (instead of rendering the inputfield) and I added the option to output the image in either .svg or .gif (if .svg, you'll have the additional ability to output the markup directly, instead of a base64).
  6. (once again I was surprised to see a work of mine pop up in the newsletter, this time without even listing the module on PW modules website 😅. Thx @teppo !) Github: https://github.com/romaincazier/FieldtypeQRCode Modules directory: https://processwire.com/modules/fieldtype-qrcode/ This is a simple module I made so a client could quickly grab a QR Code of the page's url in the admin. There's not much to it for now, but if need be you can output anything using a hook: $wire->addHookAfter("FieldtypeQRCode::getQRText", function($event) { $event->return = "Your custom text"; }) You can also output the QR code on your front-end by calling the field: echo $page->qr_code_field; The module uses the PHP library QR Code Generator by Kazuhiko Arase. When looking for a way to generate a QR Code in PW I came across @ryan's integration in his TFA module. I'm not very familiar with fieldtype/inputfield module development so I blindly followed @bernhard (great) tutorial and his BaseFieldtypeRuntime. At some point I'll take a deeper look to make a module on my own. Some ideas for improvements : add the ability to choose what to ouput : page's url / editUrl / file(s) / image(s) / ... allow to output multiple QR codes ?
  7. I'm on MacOS using Firefox. I know Firefox has its way of doing when it comes to some cases with margin-bottom... Regarding colors: maybe a suggestion would be to set the blue for buttons / nav bar to a be a bit more blue-ish. Here I took the color from the (invisible) background of thumbnails (32, 115, 206) : Edit: wouldn't mind as well to have the left and right paddings to match the ones on the header (40px left/right). And sorry for throwing you css details !
  8. Tiny detail but the margin-bottom on the footer creates a white space I was surprised at first seeing the new colors but it looks good !
  9. In the end it seems to work if I specifically save the Page Reference field: $home->save("events"); I'm still not sure though why saving the page from a guest session would break the link between images and their field...
  10. After some more testing, it looks like it's not because of the hook or the LazyCron but because of the code being executed by a guest. Edit: it's actually just the fact that I save the homepage (from a guest session) that makes the images disappear. I have access control toggled on for the homepage template but I thought API calls would be respected, am I wrong ?
  11. Yes at first I did set the output formatting to "false" but wanted to try and see how it goes without it, with no luck. I'll edit my post though, thanks. (also for completeness, I'll try again with of(false) just to be 100% sure)
  12. (I edited the title to reflect my findings down below, I'm leaving the original post as is though) Hi, This is the first time I'm using LazyCron so maybe I did something wrong but basically when the hook function is triggered and does its thing to the homepage, all images within that page disappear from the database, while remaining in the file system. When I try to re-upload the same image it tells me "Refused file X because it is already on the file system and owned by a different field" (couldn't find that other field though). Has anybody encountered something like this before ? Here is my hook, from ready.php: $wire->addHook("LazyCron::everyHour", function() { $home = wire("pages")->get(1); $home->of(false); $nextMonth = strtotime("next month"); $newEvents = wire("pages")->find("template=event, end_date>=today, start_date<$nextMonth, limit=10, sort=start_date, sort=end_date, sort=title"); foreach($home->events as $event) { if (!$newEvents->has($event)) { $home->events->remove($event); } } foreach($newEvents as $new) { if (!$home->events->has($new)) { $home->events->add($new); } } $home->save(); }); $home->events is a Page Reference field. The idea is to update the field with the ten closest events and allow the editor to sort them in the admin. Thank you !
  13. Hi Ryan, as part of your rewritting of the WireDatabasePDO class, did you get a chance to have a look at this issue ?
  14. I've never worked with custom page classes but I assume you could add a hook on the "loaded" event of your custom page and execute your custom function, something like : $wire->addHookAfter("CustomPage::loaded", function($event) { $page = $event->object; $page->yourCustomPageFunction(); });
  15. Have you tried with Pages::added ?
  16. Great to read ! About your other request, I had a look at the code and there doesn't seem to be a hook available for what you're looking for (the closest being this non-hookable function). Maybe someone else can come up with another solution.
  17. I had a different setup where I wanted my files served from a sub-domain (even though in the end it was from /site/assets/files), but it's somehow related. What I did was to point the sub-domain to /site/assets/files, and then add this hook in ready.php : $wire->addHookAfter("Pagefile::url", function($event) { static $n = 0; if(++$n === 1) { $file = $event->object; $url = $file->httpUrl; $host = wire("config")->httpHost; $url = str_replace("$host/site/assets/files", "sub.domain.com", $url); $event->return = $url; } $n--; }); You could replace "sub.domain.com" to "domainB.com/site/assets/files" (or even clear the "site/assets/files" part in your case). Hope it helps !
  18. Are these website all on the same server ? Or on shared hosting ? Or do you also have the issue locally ? I have this issue with one of my websites where sometimes the TTBF drops down. Can't say for sure as I did not investigate much yet but I assume it's because there might be other websites on the shared hosting taking too much power. Sorry I'm not helping much so here's a screen of the timings I had for your website, looks pretty normal to me :
  19. If everything seems to point to emails being sent successfully but not received, shouldn't you have a look if the emails go to spam or are refused by the receiving address ? You can try this for example https://www.mail-tester.com/?lang=en
  20. Would showing the path instead of the title be okay ? I thought of a hook first but you could do the trick with a bit of CSS ul.pw-dropdown-menu-shorter li.ui-menu-item a::before { content: attr(title); margin-right: 3px; } ul.pw-dropdown-menu-shorter li.ui-menu-item a span { display: none; } (hopefully it doesn't target anything else, but from my quick testing it looks ok !) Before: After:
  21. Isn't your code missing a bit for $roles ? Right now, and if not, you could just do echo $page->insight_author("<a href='{url}'>{title}</a>, {staff_role}");
  22. Not sure if this is what you're looking for (or if you already know about it) but explaining the focus feature to your editors might come handy for you when generating variations for srcset. If cropped, the image returned will respect the focus point and try to keep it centered.
  23. Hm not really since in the end it's about PW outputting data, whether it's within HTML tags or as a json object. Here you only provide a very small sample of your setup so it's hard to tell, but there could a number of things that impacts the performance of PW. Hooks that take a long time to execute or something... Using TracyDebugger could help you narrow down what's going wrong.
  24. At least it's cleaner ? 🤷‍♂️ Re: perf difference, I can't say for sure but maybe having the file in the root made it so it's called outside of PW's context ? That may explain why it's faster as it would be raw php.
  25. It should work for your situation as well. Render your HTML markup and once you're done and want to stop PW output call $this->halt. Try and let me know if it works. Edit: That is, in your initial setup where you have _main.php included by default after your template
×
×
  • Create New...