Jump to content

Leaderboard

Popular Content

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

  1. You can find here the release of wire-cli, successor to wire shell, a powerful command-line interface (CLI) tool designed specifically for ProcessWire developers. Optimize your workflow, automate repetitive tasks, and manage your ProcessWire projects with ease. Wire-cli leverages the Symfony Console Component to provide a robust CLI experience, offering a wide range of features and commands to enhance your development process. From creating new projects and managing fields, templates, roles, and users, to performing database backups and serving your ProcessWire projects with a built-in web-server. Still in development, there might be some glitch, I will continuously improve and expand its functionality based on the feedback and needs of the ProcessWire community. Also mentioning that we will be probably working towards merging the features of wire-cli and rockshell to provide a unified CLI solution for ProcessWire. To get started with wire-cli, check out the GitHub repository or simply install it now from your terminal using Composer: composer global require wirecli/wire-cli Contributions are welcome. If you encounter any issues or have suggestions for improvements, please submit an issue, a pull request or post it here.
    9 points
  2. On a sidenote: htmx is getting more and more attention. Recent example: It was the spotlight teaser of the last JavaScript Weekly newsletter.
    3 points
  3. Hey @Roadwolf welcome to ProcessWire and thx for the nice introduction You can read this ancient interview which tells a lot about the philosophy of ProcessWire: https://codingpad.maryspad.com/2013/07/19/interview-with-ryan-cramer-processwire-cms-founder-and-lead-developer/ While I think that this statement is not 100% correct for someone that has no coding skills at all and really does not want to learn at least the very basics the last part of the quote could not be more true ๐Ÿ™‚ I'm using it since 2013 and I'm still learning a lot and it has helped me a lot to grow ๐Ÿ™‚ So if you prefer to get things done yourself over just installing plugins you don't know and understand, then PW is a great system to choose and the community is a great place to get help once you are stuck. I don't know of any module that does that already, but creating a module on your own is easier than in any other system that I know. All you need is this: <?php namespace ProcessWire; class Nft extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Nft', 'version' => '0.0.1', 'summary' => 'Create NFTs from all images on page save', 'autoload' => true, 'singular' => true, 'icon' => 'code', 'requires' => [], 'installs' => [], ]; } } That's a fully working module that you can upload to your site and install! It does not do anything yet, so we add a hook to the init() method and then add some custom methods that we need for our use case: <?php namespace ProcessWire; class Nft extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Nft', 'version' => '0.0.1', 'summary' => 'Create NFTs from all images on page save', 'autoload' => true, 'singular' => true, 'icon' => 'code', 'requires' => [], 'installs' => [], ]; } public function init() { // hook into Pages::saved and execute the callback after a page is saved $this->wire->addHookAfter("Pages::saved", $this, "createNFTs"); } public function createNFTs(HookEvent $event): void { // get the page that has been saved $page = $event->arguments(0); // early exit if page template does not match if ($page->template != "my-nft-upload-template") return; // get images uploaded to that page // we assume they have been uploaded to the "images" field // we force the images field to return images as array // see https://shorturl.at/lorTY $images = $page->get("images[]"); foreach ($images as $image) { // $image is a PageImage object $this->createNFT($image); } } public function createNFT(Pageimage $image): void { // your code to create an NFT from an uploaded image } } Just save that file as /site/modules/Nft/Nft.module.php and click "install" in the backend, that's it. Now every time you save a page with your nft template ProcessWire will do what you want for you ๐Ÿ™‚ There is a module called MatomoWire https://processwire.com/modules/matomo-wire/ but I have not used it myself. But to use matomo you just need to copy the tracking snippet to your site. GDPR makes things a little more complicated though, so I guess you'd have to add some sort of opt-out as well. My module RockFrontend will have some helpers for that soon. As others have mentioned it's possible. But I'd also not recommend it, especially not for beginners. The problem is that many 3rd party plugins will not take that scenario into account and the risk is high that something doesn't work as expected. If you need to share code across your projects just create a module for that feature and install that module on all instances. That way you don't duplicate the workload and you can still manage the important stuff in one single location, but you have the freedom to make small changes for every instance easily. But it depends... If all your sites should be an exact 1:1 copy then some kind of multisite setup could still make sense. But I'd start a single site project first to get a quick first impression of ProcessWire ๐Ÿ˜‰ Have fun.
    3 points
  4. Thank you all! I have been able to write a script to begin the transfer of my site from drupal to processwire. So far so good. I have to mess around with the mapping and categories and such but that seems pretty simple. Just a matter of tweaking things around. I am a little confused why posts I am adding seem to be finding their way into the correct categories with the correct settings, but aren't showing up in the live main page of the blog unless you specifically seek out an article. Does the main page need articles specifically added to the feed? I haven't messed with NFT's at all honestly, but from what I understood it might be a good way to preserve copyrights on images - tho displaying the images i imagine would be tricky... not really something i am diving into yet, but I do think the concept is worthy of investigation. Or maybe it is all a little silly. I am not sure. But I will look into that script bernhard! Looks like it is super easy to create content for ProcessWire which I do like. My next task once data is transferred will be to begin to change the look of the site a little bit... But so far this is the most welcoming and helpful community I have found since reaching out. I like what I see :)
    2 points
  5. As there are already a few fans of HTMX here - just to let you know: htmx 1.9.3 has been released https://htmx.org/posts/2023-07-14-htmx-1-9-3-is-released/
    2 points
  6. Sounds super cool! The wire shell project was one of the greatest tools in the PW ecosystem. Glad it is reborn! Especially great to hear that there are plans to work on a unified solution with @bernhard's RockShell. A true community spirit! AFAIK RockShell has a lot of Rock*-specific stuff. So maybe need to think about the expandable architecture right away? Would love to test and contribute. P.S. Can't save wire shell in a single word. Is there some smart spell checking and correction going on now and how do I get around it, @Pete)))
    2 points
  7. This week the dev branch version remains at 3.0.222 but updates and issue resolutions continue as we work towards our next main/master version. I think we are quite close. Thanks for reporting issues in our processwire-issues repo. If there are older issues that I've missed, also feel free to reply to them and that'll bump it to the top when we sort by last-updated, ensuring it gets eyes on it. Thanks and have a great weekend!
    2 points
  8. I have tried multi site and there are pros and cons, chiefly: Pros - only one core codebase to maintain ( & smaller footprint, but at less than 30mb, that's not such an issue) Con - All your sites need to run on the same PW (and PHP) version. Sometimes, you may be ready to upgrade one site, but not another. On balance, I now tend to go for a different PW install for each site.
    2 points
  9. Hey! A client wanted me to update their website to make it show dates in the form "1. - 3. Jรคn. 2023" instead of "1. Jรคn. 2023 - 3. Jรคn. 2023" It's a small change but not so easy to solve, especially if you want to make it locale aware etc... So I've created "HumanDates" library which is not a PW module but a standalone PHP class so that everybody can easily use it even outside of the PW universe: https://github.com/baumrock/HumanDates Usage is simple and the library can be used as a strftime replacement: // manual download require_once "/path/to/HumanDates.php"; // using composer // composer require baumrock/humandates require_once "/path/to/composer/autoload.php"; // create HumanDates instance $dates = new HumanDates(); echo $dates->format("2023-01-01"); // 1. Jan 2023 echo $dates->range("2023-01-01", "2023-01-03"); // 1. - 3. Jan 2023 If it is useful to you please let me know by giving it a star on github ๐Ÿ™‚ https://github.com/baumrock/HumanDates/stargazers PS: It will be available in RockFrontend in the next release simply by calling $rockfrontend->humandates() ๐Ÿ˜Ž
    2 points
  10. 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
  11. Stores a GeoJSON FeatureCollection and its bounds drawn on a MapLibre map. Here's the README.
    1 point
  12. Greetings all! I am Roadwolf, a casual blogger. I have had my blog running for about 18 years now. It started on simple HTML and then wordpress for a while, but much of it's life has been on Drupal. I have now grown tired of Drupal's push to update from 7 to 10 and have had nothing but issues and wasted time in attempting to accomplish that. I am looking to replace my Drupal install with a new self hosted CMS, which ideally will allow me to run several domains off of the same backend if possible. But at minimum I want an easy to maintain site, with access levels / private post options. I mostly write, but also enjoy posting the odd photo album/story. I wonder if there is any sort of integration to turn photos uploaded into NFT's automatically with this CMS? It is something I was pondering as a way to ensure copyright? but never really dived into yet. Tracking visitors and hits is also important to me. I love knowing where people are visiting my site from. So built in analytics or the ability to use matomo or something would be ideal. I like to avoid using cloud or non-self hosted services. I do tend to enjoy doing things the 'hard way' or old school way when it comes to scripting and customizing things. But I also enjoy and appreciate a helpful and friendly community, to help me learn and guide me when I am tackling a new project such as a new CMS. And I hope to find that here? I look forward to a reply, and thank you for your time. Nice to meet you all :)
    1 point
  13. Could you give us a bit more of details of how your structure / pages tree look like ? Also, which "output strategy" did you choose ? Basically, the main page - which by default is called `home` with a template also called `home` - doesn't require something special. You have full control of what and how things are displayed. If for example, your tree look like the following: Page Title [template name] -------------------------- |- Home [home] |--- Blog Parent [blog] |------ Post1 [blogpost] |------ Post2 [blogpost] To show blog posts in the frontend page Home [home] (home.php) you want to write something like: <?php namespace ProcessWire; $blogposts = $pages->find("template=blogpost, limit=10"); // this is a selector, $blogposts will contain the two page objetcs Post1 and Post2 // loop through all blogposts contained in variable $blogposts foreach($blogposts as $post) { echo "<h2>$post->title</h2"; // echo title field $excerpt = substr($post->body, 0, 150); // simple excerpt to illustrate, 150 chars from body field echo "<p>$excerpt</p>"; } Hope you get the idea.
    1 point
  14. OHHH, SORRY! I've replyed from my co-worker account: I'm Cybermano. --- Hi @Ivan Gretsky, as promised I made a PR on GitHub: hope it's ok. Basically I added a new InputfieldCheckbox in the InputfieldLeafletMapMarker.module fields configuration. Then I setted it in the constructor and also assigned to a variable into the ___render(): if the checkbox is checked, this variable will inoculate an html class ("scrollwheel-disabled") into the div.InputfieldLeafletMapMarkerMap. At the end, into the InputfieldLeafletMapMarker.js, if the div has this class assigned, map.scrollWheelZoom.disable() will do the work. Sorry, I didn't found a cleaner way ๐Ÿคซ: hope this could be helpful or of inspiration.๐Ÿ™‚ I attach the two file here, too. InputfieldLeafletMapMarker.js InputfieldLeafletMapMarker.module
    1 point
  15. Absolutely! Even their Twitter account is having fun right now and ThePrimeAgen is on board of course. https://twitter.com/htmx_org https://www.youtube.com/results?search_query=primeagen+htmx
    1 point
  16. Another link from the official doc for more informations about multisite: https://processwire.com/docs/more/multi-site-support/
    1 point
  17. This is really cool and does exactly what I want. Thx.
    1 point
  18. 1 point
  19. Indeed, Iโ€™ve been finding HTMX very useful indeed โ€” and I was surprised to see that Iโ€™m several versions behind. I spent quite a while looking for the intervening release notes. I couldnโ€™t find any at htmx.org, but they are available via UNPKG: https://unpkg.com/browse/htmx.org@1.9.3/CHANGELOG.md Looks like itโ€™s time to upgrade! ๐Ÿ™‚
    1 point
  20. There is a way to have pages returned by $pages->find(), $pages->findRaw(), etc, in the order of some supplied IDs. You use "id.sort" in the selector: https://processwire.com/blog/posts/pw-3.0.200/#pages-api-additions $data = $pages->findRaw('id.sort=1014|1|2', ['id', 'name', 'title', 'url']); You have to supply the IDs for all the pages you want to match: https://github.com/processwire/processwire-issues/issues/1581
    1 point
  21. I'm using Matomo now, because it was too much hassle for me to host plausible myself. I hosted it as docker app which was quite simple (only challenge being the reverse proxy setup), but the backup part was a pain. No instructions, no help, so I decided to take the short path and just add a cronjob that shuts down docker and then copies all files to a directory that get's then backed up every night from my server control panel. That was not ideal at all and the docker backup took over 30GB of data within a very short period of time on a tiny site, meaning just hosting plausible ate 70GB of my server ๐Ÿ˜ž So I decided to give Matomo another try and as it uses PHP+MySQL it fits perfectly with my server panel and all backups run without any configuration every night smoothly and efficiently. DB size is 2,5MB at the moment ๐Ÿ˜„ And you get a lot more insights with Matomo and have a lot more options. Though the dashboard is by far not so pretty...
    1 point
  22. Would also go with one PW install and one DB per website. PW is easy to update by just replacing the core files located in /wire (and .htaccess, index.php in the root), while keeping untouched all the stuff in your /site folder. DB migration is easy too compared to older WordPress sites, as no hard coded page links with fixed domains are stored in the DB. Really like how easy you can deploy a site developed locally to a live server.
    1 point
  23. Hello @Roadwolf welcome here ! I will let other members giving you a better written introduction and greeting and I will most try to give some answers and thread links to confirm you ended on the right place. Your 18 years old website/blog deserve a good software to run on. Recently, a member posted about his website thats was not working (spoiler: we are talking about the backend side) where it turns out to be more of a "problem" with the hosting provider configuration. Just speaking about it, first because ProcessWire get updated every friday (this can be tracked on github and in the announcement section here in the forum), it let you being confident on how robust and secure the software is, secondly, we almost never seen an upgrade being problematic, even going from major version 2 to 3, assuming you have a small technical habits to follow basics steps. About multisite, I think yes, but I have never personally tried, so others will answer to it. Then you will love it ๐Ÿ’ฏ Even GPT tends to throw a lot of confettis on this community, if you ask her, you will love it ๐Ÿ’ฏx 2 ๐Ÿ˜ Interesting. The answer is no, at least there is no built-in solution, and from what I know, there is no module available for that. But it can be achieved really easily, thanks to ProcessWire freedom. The day you start to put your hands on it, do not hesitate to ping me, I have personally some experiences with NFTs, smart-contract and all this mess so I could give some help in this regard. Yo will find a lot of resources here on the forum, well explained, and do not be afraid if you see some tens years old junks of code, they will almost all still work ๐Ÿ˜„ , give a read to the nice blog posts, register to weekly.pw to receive the best of it each weekend for nice read while taking coffee. Enjoy your PW journey ๐Ÿ™‚
    1 point
  24. 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!
    1 point
  25. A few screenshots to demonstrate:
    1 point
  26. Food Allergens Module A simple List of Food Allergens My needs were to provide a simple list of food allergens for our clients with restaurant related activity. The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window. This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea. This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens. --- Main features The basis All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module). Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list). A step further With the tips of @bernhard, @Soma (and many others), see here , the magic happens. The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list. A little further Why scroll to the top of the page to click a link? The next step was to create a sticky button only in the food menu pages. Again with a @bernhard tip I moved into the customization of this simple module and the related hook. --- How to use this module After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM): View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens". At the same way, the option for the sticky button, but with a plus The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>. Video Explanation In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call. This because I've set a specific one for each allergen to show up a tooltip in the front end. Registrazione #33.mp4 Registrazione #34.mp4 --- Last but not the least Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible. I always learn a lot here, so I would share my code for whom it could be interested. I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module. Obviously you are free to modify the code as per your needs. Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). ? I hope be helpful or for inspiration. Bye ready.phpList-ITA.htmlList-ENG.htmlAllergens.module README.md
    1 point
ร—
ร—
  • Create New...