ProcessWire Weekly #320

In the 320th issue of ProcessWire Weekly we're going to check out the latest core updates (ProcessWire 3.0.161), a new third party module called Fieldtype Runtime only, an IndieWeb themed article from Francesco Schwarz, and more. Read on!

Welcome to the latest issue of ProcessWire Weekly! In this issue we've got once again some pretty interesting topics to cover, ranging from the latest core updates — which include a really neat addition to the ProcessWire selector engine — to third party module called Fiedltype Runtime Only, and more.

Just today I came across this wonderful article from Francesco Schwarz about his recent experiments related to transmitting run data from Garmin watch to a ProcessWire site, and visualizing it there. The article was so detailed and well authored that I just had to feature it in this weekly issue, so stay tuned for that as well.

We're currently in the midst of a downright brain-melting heatwave, so forgive me if I forgot to mention something important. Anyway, I'm not going to complain about it — better enjoy the warm weather while it lasts. Hope the weather is great wherever you are as well. Have a great weekend, folks! :)

Thanks to all of our readers for being here with us again, and as always, any feedback is most welcome – please don't hesitate to drop us a line if there's anything in your mind you'd like to share with us.

Latest core updates: ProcessWire 3.0.161

In this week's core updates post, which was released via the support forum, Ryan introduces ProcessWire 3.0.161. This version is a continuation of last week's 3.0.160, and includes additional selector operator enhancements, as well as code rewrites and optimizations to make things as slick as possible.

Last week I was still kind of figuring it out and the code still needed some refactoring and optimization. This week several parts have been rewritten and it's been improved quite a bit. Though the end result is still very similar to what was demonstrated last week, but now it's a lot more performant and solid.

— Ryan

New in 3.0.161: specifying multiple operators for a selector string

If you perform a query such as $pages->find("title*=hello world") and get no results, that's it; you'll get zero results back, period. As of 3.0.161 you now have another option: specify a second operator — e.g. title*=~=hello world — and it'll be used as a fallback that kicks in only if the initial query returned no results at all.

You can stitch together more than just two operators: title*=~=~|=~|*=~|%=hello world is a valid selector string, albeit probably not one you would typically want to use. Also it may look a little intimidating, it's really not that difficult to grasp: it's really just a single query that could (at most) be repeated five times with different operators.

(Tip: count the number of equals signs and you'll know how many operators there are. This is also the maximum number of times the query may run.)

As for where you might want to use this feature, think of a search engine: you probably want to prioritize direct matches, but at the same time you might also want to display something even in case there's only a partial match.

For more examples and a detailed walkthrough of the newly added alternative operators feature, be sure to check out the weekly core updates post from Ryan. Thanks!

New module: Fieldtype Runtime Only

For this Weekly issue we have one new third party module to share: Fieldtype Runtime Only by Robin Sallis. As the name suggests, this is another shot at a runtime-only field, where instead of storing values, the field — or rather the Inputfield part of the Fieldtype and Inputfield combination — is dedicated to processing and displaying information.

Fieldtype Runtime Only doesn't save values to the database, but rather serves as a tool for executing and displaying values from predefined PHP files:

  • Markup is rendered from a file: /site/templates/RuntimeOnly/field_name.php. This file has access to API variables, including $page (the page being edited), $field (current Field object), and $inputfield (current Inputfield object).
  • If found, JavaScript and CSS files (/site/templates/RuntimeOnly/field_name.js and /site/templates/RuntimeOnly/field_name.css) are automatically injected into the Admin.

For more details, as well as some discussion regarding other similar solutions, be sure to check out the Fieldtype Runtime Only support forum thread. Thanks to Robin for yet another very useful contribution — great work as always!

Running on my own — an article from Francesco Schwarz about migrating data from Garmin to ProcessWire

This week we'd like to highlight an article authored by Francesco Schwarz regarding a very interesting IndieWeb-themed experiment, in which he has been transferring running data from a Garmin watch to his own ProcessWire powered website.

Since I started my IndieWeb journey this month I’ve been thinking a lot about the digital content I’m producing and how I can be more in control of my data, avoiding data silos as much as possible.

— Francesco Schwarz

As Francesco explains in his article, the process of migrating data from a physical watch to his site wasn't exactly straightforward, and there were various gotchas on the road. This article will walk you through each step of the process:

  • Initial attempts to pull data from the device using its export feature and store it locally, as well as a quick dive into the Garmin export data format.
  • The migration script used for converting and storing data from the Garmin data format into ProcessWire page(s).
  • Automating the whole process by utilizing a combination of Garmin API, PHP Garmin Connect library, and a cron job.
  • And, finally, visualizing the data using SVG graphs and some fancy progressive JavaScript wizardry.
Some run data displayed on the front-end of Francescos ProcessWire powered website.

Although this article contains a lot of techy-sounding buzzwords all the way from APIs and package managers to data aggregation and visualization, it's also very well written and really easy to follow. It's also worth noting that the very same principles apply to a lot of use cases, so even if you don't currently happen to own a Garmin watch, this article is still a valuable source of information.

Big thanks to Francesco for sharing his journey with us, very interesting indeed!

Site of the week: bots4you

Our latest site of the week belongs to bots4you — "the AI-powered platform with in-depth industry knowledge".

The German company behind this website is called bots4you GmbH, and they specialize in providing chatbots for specific industries based on their own, self-developed artificial intelligence platform. The goal of their bots is to both improve the quality of customer service, and drive in more sales — so, essentially, a win-win situation for both customers and businesses.

The bots4you website was built by Marc Hinse, and introduced in a recent showcase forum thread. Albeit chatbots and AI are very much a technical topic, the design of the site is everything but with its nice and "organic" design made of flowing shapes and warm colours. Overall look and feel of the site are very nice, and the flowing and constantly changing shapes are a nice touch.

According to Marc, behind the scenes this site only has one template, and the bulk of the content is built using predefined "content modules" implemented using Repeater Matrix. When it comes to the front-end of the site, here most of the heavy lifting is performed by the utility-first CSS framework Tailwind.

Thanks to Marc for sharing this project with us, and congratulations to bots4you for their new website — it's looking fantastic!

Stay tuned for our next issue

That's all for the 320th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 4th of July. As always, ProcessWire newsletter subscribers will get our updates a few days later.

Thanks for staying with us, once again. Hope you've had a great and productive week, and don't forget to check out the ProcessWire forums for more interesting topics. Until next week, happy hacking with ProcessWire!

Post a comment