ProcessWire Weekly #352

In the 352nd issue of ProcessWire Weekly we're going to check out the latest core updates available in ProcessWire 3.0.172, introduce a neat third party module called Admin Autosize Textareas, and more. Read on!

Welcome to the latest issue of ProcessWire Weekly! Hope you folks have had a nice week so far, and are ready to dive into some ProcessWire news and updates.

In this week's issue we'll walk you through all the neat new features included in the latest development version of ProcessWire, 3.0.172. We'll also take a quick look at an older third party module Admin Autosize Textareas, and introduce a new site of the week — keep on reading for more details.

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. Enjoy our latest issue and have a great weekend!

Latest core updates: ProcessWire 3.0.172

In the latest post at the blog Ryan discusses some of the brilliant new features introduced in ProcessWire 3.0.172, primarily focused on finding and/or loading pages faster and with smaller overhead in terms of memory and CPU usage.

Programmatic autojoin options

Let's say that you want to find all your blog posts, and show them in a list where you're going to use three fields: "title", "date", and "summary". With the new autojoin feature you could speed this query up by specifying said fields like this:

$posts = $pages->find('template=blog-post, field=title|date|summary');

The key here is the "fields" option, which specifies the fields to autojoin. Alternatively you can use keyword "join" instead of "fields", or use another new addition — the $pages->findJoin($selector, $fields) method:

$posts = $pages->findJoin('template=blog-post', ['title', 'date', 'summary']);

Another way to use the autojoin feature is to prevent autojoining altogether — a very nice way to optimize things in case you only need to access native page properties:

$pages->findJoin($selector, false);
$pages->find("$selector, field=none");

Finding or getting raw or fresh data

ProcessWire 3.0.172 also includes the findRaw(), getRaw(), and getFresh() methods we briefly mentioned in our previous issue:

  • $pages->findRaw() takes in a selector string and a field name or an array of fields, returning the raw, unformatted data for said field (or fields) as a PHP array. Field name(s) may contain wildcards, and you can also request subfield values.
  • $pages->getRaw() is the singular version of $pages->findRaw(), with very similar considerations as $pages->get (requested page is returned with no exclusions, validation for status etc.)
  • $pages->getFresh() is a version of the $pages->get() method that always returns an uncached version of a page. This is useful if, say, you need to compare current instance of a page with the unmodified version stored in the database.

That's it for the core updates this week. Be sure to check out the blog post by Ryan for more details and examples, as well as an in-depth look into the whole concept of autojoining fields. Thanks!

Introducing the Admin Autosize Textareas module

This week we've got an older module that we've never (as far as I can remember, that is) featured before: Admin Autosize Textareas by tpr and netcarver. Based on admin tweak shared by tpr via the support forum, this module makes use of the Autosize JavaScript library in order to make regular textareas scale automatically based on their contents.

Both tpr's original solution as well as this module were released way back in 2016, and the module hasn't seen any updates in years, but the concept is still valid and it works just fine. If you want to see textareas automatically scale, similar to the way the inline mode in CKEditor works, this module is an easy drop-in solution for exactly that need.

Big thanks to both tpr and netcarver for this handy little helper module!

Site of the week: Backwards Compatible

Our latest site of the week belongs to a project called Backwards Compatible. This site is a database of PlayStation 4 games along with details about their compatibility and performance on the new generation version of the console, PlayStation 5.

The site in itself is relatively simple, but there is a rather sophisticated search feature that includes free-form text search, as well as various predefined tags relating to features of the games. The GUI of the site is slick, and just overall the whole experience looks great and feels effortless to use.

The public facing part of this project appears to be built using the Bootstrap front-end framework, and there are some additional libraries included here as well — Slick, Popper, Tippy.js, Font Awesome Pro, and so on. The comment form is powered by Commento, and behind the scenes this site is being optimized by the commercial ProCache module.

We're happy to have this site featured in the sites directory, so big thanks to the developer behind this project for sharing it with us! In case you'd like to support this project, there's a Patreon page for it, and the site also lists affiliate links for buying games online.

Stay tuned for our next issue

That's it for the 352nd issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 13th of February. 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