Jump to content

Recently Updated Topics

Showing topics posted in for the last 7 days.

This stream auto-updates

  1. Past hour
  2. OMG. So easy. Although not quite self-explanatory… Thank you! 🙂
  3. Today
  4. Hi @biber I don't think the sort() function is available to pageimages because pageimages is not WireArray. The result of the below line returns nothing. $images = $page->images->sort("iname_".$order, SORT_NATURAL |SORT_FLAG_CASE); Then foreach($images as $image) Give error because the variable $images is empty. Gideon
  5. @Gadgetto I am struggling with webhooks :-) In the docs it says: * All hookable event handler methods will return an array containing payload Snipcart sent to your endpoint. * In addition, the following class properties will be set: * * $this->payload (The payload Snipcart sent to your endpoint) * $this->responseStatus (The response status your endpoint sent to Snipcart) * $this->responseBody (The response body your endpoint sent to Snipcart) * * (Use the appropriate getter methods to receive these values!) * * How to use the hookable event handler methods (sample): * ~~~~~ * $webhooks->addHookAfter('handleOrderCompleted', function($event) { * $payload = $event->return; * //... your code here ... * }); * ~~~~~ * * PLEASE NOTE: those hooks will currently only work when placed in init.php or init() or ready() module methods! * I have setup a hook for order.completed in the init method of a custom autoload module public function init() { ... // SnipWire Webhooks $this->wire->webhooks->addHookAfter('handleOrderCompleted', $this, 'handleOrderCompleted'); } Issueing post requests to the endpoint returns an empty response body While in the docs it says: when I var_dump($event->object->getResponseBody()) in my handler method, it gives an empty string which explains why the response body is empty. How can I set responseBody from within my hook handler method? There is no setter for that and Webhooks::responseBody is private, so I have no way to set it in my handler. To solve this, I introduced a setter method to the Webhooks class /** * Setter for responseBody. * * @param string $responseBody * @return void * */ public function setResponseBody(string $responseBody) { $this->responseBody = $responseBody; } Now in my handler method I can do $event->object->setResponseBody('{"test": "test"}'); Which results in While I was at it, I also added a setter for responseStatus. Not sure if you still maintain this module, so I will add this to my fork just in case anyone still needs it.
  6. @bernhard: Thanks to your forum thread, I finally did the switch from my previously used XAMPP development stack to WSL2/DDEV on my Windows 11 machine. Now I do all my Python, PHP and Node/Html projects within the Linux subsystem on Windows 11 using VS Code as my editor of choice. Only Windows Desktop C# projects (WinForms, WPF) are still done on the Windows side using Visual Studio 2022. Always wanted SSL certificates on my localhost. Installation was easy and my first project was set up within minutes by simply cloning and importing my MySQL dump into my ddev container. Thanks for the inspiration.
  7. Yesterday
  8. OK, here's my slightly revised `router.php` script: <?php if (PHP_SAPI !== 'cli-server') { die('Expected cli-server'); } if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME'])) { return false; } $_SERVER['SCRIPT_NAME'] = '/index.php'; $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME']; require $_SERVER['SCRIPT_FILENAME']; The main change is that `$_SERVER['SCRIPT_FILENAME']` is now an absolute path. Not critical, but more correct.
  9. Ryan has always done this (I really don't know why), but the tag on GH is added for the previous master version when the next master version is released and made available from the PW site's download page.
  10. Me too! This is now default in all my installations for all the reasons you mention. But I feel this sort of update would be a PW4 thing?
  11. Hi @Christophe Unfortunately we don't have Code Intellisense or autocomplete in latte files at the moment 😞 See https://github.com/smuuf/vscode-latte-lang/issues/5 You are adding the method "listchildren()" to your ParentPagePage, nowhere else. That means you can all this method only on pages that have the template "parent-page". Why should it do that? You are calling a method of an object. If that does not exist it is expected to throw an error. You CAN do what you describe though. Sometimes it is useful and I'm doing that as well. You could add that method to your DefaultPage.php and there return an empty sting. That would make $page->listchildren() return "" by default, which means it does not throw an error. For some page types you can then implement a different logic: DefaultPage.php --> listchildren() { return ""; } FooPage.php extends DefaultPage --> listchildren() { return "foo!"; } BarPage.php extends DefaultPage --> listchildren() { return "BAR"; } // in any template echo $page->listchildren(); That it totally up to you. Same with regular ProcessWire templates. It's up to us devs how we organise things and everybody does it differently. I can only say what I came up with and what works great for all kings of projects (from very simple to very complex ones): layout.latte for main markup /site/templates/sections/... for all sections /site/templates/partials/... for all partials Details: layout.latte --> holds the html markup skeleton of the page, eg: <html> <head>...</head> <body> <header>...</header> <main>...</main> <footer>...</footer> </body> </html> Then all my template files are usually empty (like home.php, basic-page.php, foo.php, bar.php). Next, I divide my design into sections. A section is a portion of the page that goes from the very left to the very right and has an undefined height/content. You can then add those sections to your main markup file like this: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {include "sections/content.latte"} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> This is often all I need, because I build all the available sections in RockPageBuilder and then I can simply add them to the pages as I need them. But it works without RockPageBuilder as well. You then just need to code all your page layouts depending on the page template. If all those pages share the same breadcrumbs and content-footer it could look like this: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {if $page->template == 'foo'} {include "sections/content-foo.latte"} {elseif $page->template == 'bar'} {include "sections/content-bar.latte"} {else} {include "sections/content.latte"} {/if} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> You could also use a dynamic approach: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {include "content/" . $page->template . ".latte"} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> It's just regular PHP inside the latte tags, so you could also do is_file() checks etc: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {var $file = "content/" . $page->template . ".latte"} {if is_file($file)}{include $file}{/if} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> Obviously you'd need to create those files. Here I'm placing them into a new folder called "content", which would be /site/templates/content/foo.latte for example. Next, partials: If you have repeating markup inside your sections you can outsource them into the partials folder. For example let's say you want to show a blog overview page that shows all single blog items as cards. You'd have a section like "blog-overview.latte" like this: // blog-overview.latte <div uk-grid> <div n:foreach="$page->children() as $item"> <div class="uk-card"> <h3>{$item->title}</h3> <p>{$item->teaser()}</p> </div> </div> </div> This example is very simple and if you only use your cards here, then it's easier to leave them here. If you are using the exact same cards on two or three places then you can create partials for them: // blog-overview.latte <div uk-grid> {foreach $page->children() as $item} {include "partials/card.latte", item: $item} {/foreach} </div> // /site/templates/partials/card.latte <div> <div class="uk-card"> <h3>{$item->title}</h3> <p>{$item->teaser()}</p> </div> </div>
  12. Hey @bernhard, just updated a site to Rockfrontend 3.13.1 and noticed that auto-loading assets via $rockfrontend->styles()->add('foo.css'); $rockfrontend->scripts()->add('bar.js'); now has the order reversed in the generated markup. <script src='bar.js?m=1712642262'></script> <link href='foo.css?m=1713850912' rel='stylesheet'> Which in case of using UIKit is probably not ideal, since in my understanding the CSS should be loaded before the JS. Can you reproduce this or is something messed up on my part? Also, on a live site and with debug mode off, RF still renders a tag <script>var RockFrontend = {"isDDEV":false}</script> in the html head, wonder if that is necessary or what the purpose of that could be. Any pointers here? Not using RockFrontend.js if that's related in any way. Greetings to Austria and thanks in advance! 🙂
  13. If you truly want to make an admin theme from scratch like I'm doing, it's best to just take AdminThemeUikit, since that is the "official" and most supported theme and rip out UIkit and start replacing it with your own approach and just hack away at it. Keep in mind that ProcessWire makes heavy use of jQuery UI and a few other libraries so you'll have to play nicely with them unless you want to replace them too, but that takes it to another level. With Bootstrap, it's straight-forward enough given the similarities with UIkit, although this is turning out to be more work than I anticipated. But that was the point since I want it to force me into looking at how everything is interconnected. One idea for an admin theme is to do it with pure, modern CSS and as little JS as possible and as accessible as possible (good reason why here).
  14. I have managed to save the charge id to the order. For this to work I needed to make captureOrder hookable. This is probably not the right way tough.. $wire->addHookAfter('PadloperProcessOrder::captureOrder', function(HookEvent $event) { $paymentIntent = $event->return; $orderId = $paymentIntent->metadata->reference_id; if ($paymentIntent && $paymentIntent->status === 'succeeded') { $chargeId = $paymentIntent->latest_charge; // Load the order page using the order ID and save the charge ID $orderPage = wire()->pages->get("template=padloper-order, id={$orderId}"); if ($orderPage->id) { $orderPage->of(false); $orderPage->set('stripe_charge_id', $chargeId); $orderPage->save(); } } });
  15. Last week
  16. Thought this might be interesting for the UIkit/Tailwind users, maybe best of both worlds?? https://www.franken-ui.dev/docs/introduction
  17. Also another possibility - are you running Debian? If so, I find I have the same issue unless I add this to config.php /** * Enable Session Garbage Collection * Garbage Collection is disabled in Debian as default (probability set to zero) * Enable session garbage collection with a 1% chance of running on each session_start(); * Chance calculated as gc_probability/gc_divisor * Session path is defined inside wire/core/Session.php and points to site/assets/sessions * Thanks to this modification session now takes into account gc_maxlifetime set in config */ ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 100);
  18. Dear all, thank you for all submissions. We will be contacting all of you whitin this week. Please do not send any further applications. All best, Dino
  19. I don't know anything about the history of `strtr` in PHP, but my guess would be that the reason it has the ability to replace strings in the first place is simply an extension of its original purpose from single-byte characters to multi-byte. It just so happens that in PHP multi-byte characters are represented as strings… I don't know if that's right, but I've seen it in other languages, so it certainly seems plausible. And when you have that in your head using it to just replace arbitrary strings feels, you know, funny. 🙂
  20. Hi @Chris-PW I removed the javascript block for meta-shift-s and ctrl-s. After that, pressing ctrl-s in TinyMCE worked perfectly. Tested in Chrome/Windows11 and Firefox/Windows11, and via BrowserStack, also in Safari 17.3/MacOS Sonoma. Additionally, I removed the timeout in UIkit.notification(...) in QuickSave.js, because my pages have so many fields and languages that saving the page takes several seconds. And because the page is reloaded anyway, in my case it was better to simply leave the notification until the page reloads.
  21. I haven't dug too deeply into this yet, but is I saw there is supported integration with TextformatterVideoEmbed - I'm wondering if this could apply to either TextformatterOembed / FieldtypeOembed postprocessing as well, or if that requires more fine tuning because of how different providers may offer different embedded content. Perhaps all of these fall under external-media?
  22. Thanks for explaining in brief. You made my day.
  23. Problem solved. Ryan mentioned in the issue report that only files are protected that are uploaded after the $config->pagefileSecure setting is in place. I was not aware of that and I couldn't find that requirement documented anywhere when doing a search prior to posting this issue. Done a search again which pulled up this forum thread I suggest to add that information to the entry for `$config->pagefileSecure` at https://processwire.com/api/ref/config/
  24. This week we have ProcessWire 3.0.238 on the dev branch. This version contains 17 commits containing new features (some via feature requests) as well as issue fixes. Recent updates have been nicely covered in ProcessWire weekly issues #517 and #518. Also added this week are the following: Improvements to ProcessPageClone, which now supports some new options such as the ability to configure it to always use the full clone form (a requested feature), and an option to specify whether cloned children should be unpublished or not. New $datetime->strtodate($date, $format) method that accepts any PHP recognized date string and reformats it using the given format. It also supports date strings that PHP doesn't recognize if you give it a 3rd argument ($options array) with an `inputFormat`. The existing $datetime->strtotime() method now supports an `inputFormat` option as well. The Inputfield class now has new methods: $inputfield->setLanguageValue($language, $value) and $inputfield->getLanguageValue($language), added by the LanguageSupport module. Previously there were no dedicated methods for this, so you had to manage them with custom keys containing language IDs if you wanted to programmatically use an Inputfield in multi-language mode. The ProcessWire.alert() JS method has been updated with an auto-close option (`expire` argument) that automatically closes the alert box after a specified number of seconds. InputfieldDatetime has been updated with 7 new interactively configurable settings for the jQuery UI date picker. See the screenshot below for an example of a few. Plus, its API has been updated with the ability for you to specify or override any jQuery UI datepicker option, either from PHP or JS, as requested by Toutouwai/Robin S. See the new datepickerOptions() method and phpdoc for details. Next week we've also got some more updates to InputfieldTable that take the newly added actions even further and make them easier to use. Thanks for reading and have a great weekend!
  25. Thanks - that did it! Looks like forcing "isLocal" was what I needed here. In this case it's not a guest, though I'm guessing the permission level is equivalent to guest. (I haven't explicitly added any tracy related permissions to roles.)
  1. Load more activity
×
×
  • Create New...