Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/09/2023 in all areas

  1. I can see a couple of problems. The purpose of strtotime() is to "Parse about any English textual datetime description into a Unix timestamp". But you are supplying it with a variable that is already a Unix timestamp. So that will cause strtotime() to fail and return false. And then that false return value is then being supplied to strftime(), which instead needs to be supplied with a Unix timestamp. Also not sure that ucwords() would be needed, as I think the date string returned by strftime() should already be capitalised correctly. So probably it should be this: function dateToItalian($unixtimestamp) { setlocale(LC_TIME, "it_IT.utf8"); return strftime("%a %d %B %Y", $unixtimestamp); }
    4 points
  2. The new dev branch version 3.0.222 contains about 20 commits and 16 issue resolutions. In terms of new features, last week I mentioned some upgrades to WireHttp, and below are this week's additions: Multi-language month and day names The WireDateTime class (aka the $datetime API variable) has been updated to support multi-language month and day names. Now all month and days are translatable in the WireDateTime file (/wire/core/WireDateTime.php). So if you request any date in a format that uses month names or abbreviations, or day names or abbreviations, they now support multi-language, whether you requested it from the wireDate() function or the $datetime API variable. ProcessWire has long supported multi-language month and day names when using a PHP version prior to 8.1 and you've requested a strftime date format that uses them. But PHP 8.1 dropped the multi-language supporting strftime() function, without leaving a suitable replacement. PHP's IntlDateFormatter can't be relied upon since it's not always compiled with PHP. But as of PW 3.0.222, now we have a suitable replacement. Though it does require you to translate the 7 days and 12 months for file /wire/core/WireDateTime.php using ProcessWire's language translation tool. Note that unlike the previous strftime() solution, the new solution no longer requires you to use strftime() format codes and you can instead use regular date formats and they will be translated automatically. New conditional hooks that match by argument type Another new addition this week is support for conditional hooks that match by argument type. I think this is especially useful combined with ProcessWire's custom page class support. It enables you to make a hook apply only to methods containing arguments of a specific type. For instance, if you had a custom page class "ProductPage" for template "product" and you wanted to capture the "Pages::saved" event for pages of that type (ProductPage) you could do so like this: $wire->addHook('Pages::saved(<ProductPage>)', function($event) { $product = $event->arguments(0); /** @var ProductPage $product */ $event->message("ProductPage '$product->title' has been saved"); }); In addition to supporting class or interface names, you can also specify regular PHP types such as <array>, <string>, <int>, <object>, etc. For more details on this type of hook see the new Conditional hooks that match argument type section of the Hooks documentation. Thanks for reading and have a great weekend!
    4 points
  3. There’s also this really good tutorial on how to achieve a customizable cookie notice with plain JavaScript using the dialog element: https://www.thomasvantuycom.com/writing/simpler-cookie-notices/
    2 points
  4. Hello all, Sharing some issues that I've had with Dreamhost that I've seen over the last week for ProcessWire sites. This doesn't seem to be caused by ProcessWire itself or it's code. Wanted to let others know in case anyone has sites currently hosted with them. I have several sites on a VPS through Dreamhost (both PW and non-PW). I've been overall happy and have had very few problems over the ~10 years I've used them. Their support team has been great and they are currently working on the issues. Recently it appears that some server config changes made by their admins broke image uploads within ProcessWire. Uploads fail with the UI continually showing the upload spin animation over the image. I initially contacted support regarding one of my client's sites after they told me they were having issues. I then tested this on a different ProcessWire site hosted on the same VPS to check that this wasn't a code issue specific to that one site and it appears that this may affect multiple ProcessWire sites (maybe just on my VPS, not sure yet). The server would return HTTP 418 (cute) and the upload would fail. All other functionality appears to be unaffected. After testing the second site I thought to throw it out here on the forums to see if anyone else hosts PW sites on Dreamhost and have been experiencing this, or give a heads up to people who may want to check on their sites.
    1 point
  5. Page List Auto Expand Automatically expands the next adjacent page when moving a page in Page List. Usage As you are moving a page in Page List, if you position the yellow move placeholder above a Page List item for a configurable period of time (default is 1000 milliseconds) then that item will expand, allowing the moving page to be dropped as child page. Configuration In the module config you can set the delay before the Page List item adjacent to the move placeholder will be automatically expanded. Restricting the module to certain roles If you want to restrict the module functionality to only certain roles then create a new permission named page-list-auto-expand. If that permission exists then a user's role must have that permission or the module will not have an effect in Page List. https://github.com/Toutouwai/PageListAutoExpand https://processwire.com/modules/page-list-auto-expand/
    1 point
  6. Code GPT Visual Studio Code extension that lets you generate code from plain text within the editor using the official OpenAI API or other AI providers such as Google PaLM 2. https://marketplace.visualstudio.com/items?itemName=DanielSanMedium.dscodegpt https://codegpt.co/
    1 point
  7. Of Just use the newest PW DEV Version ?
    1 point
  8. Never mind. The simplest way to do this is include $rm->watch methods in ready.php that cover the subset I want to pay more immediate attention to and then run migrate those watched files there: $rm = $this->wire->modules->get('RockMigrations'); $rm->watch($wire->config->paths->site.'/migrations',2); $rm->watch($wire->config->paths->site.'/migrations/matrixtypes',1); bd($rm->getChangedFiles()); // Just to check on things. $rm->migrateWatchFiles();
    1 point
  9. How about using an int field for the price - but in cents, not dollars and cents. Would, of course, require formatting when displaying and storing the value.
    1 point
  10. This is likely to be the problem. As @ngrmm mentioned, selector operators like > and < depend on the fieldtype used, so for a price you would want to use an integer field if you only need whole dollars, or a decimal field for dollars and cents (the decimal field is the better choice for futureproofing).
    1 point
  11. The ProcessPageList.js is pretty complex and there are things in it I don't understand. I had to do some some rather hacky stuff to get the module working, but the stakes are lower in a module because each person can decide if they want the functionality and are willing to install a beta module to get it. Whereas if I make changes to the core in a PR it might break something for everyone. So I'll wait a while to see if any issues crop up before considering a PR.
    1 point
×
×
  • Create New...