ProcessWire Weekly #137

The 137th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!

First of all, we'd like to wish all of our readers a Merry Christmas and Happy New Year! We've got a pretty interesting timing this year: this issue comes out on the Christmas Eve and our next issue comes out on the New Year's Eve. 'Tis the season :)

In this week's issue we're going to cover the latest updates from the blog, take a look at two new modules, and of course introduce a lovely new site of the week. Next week we might include something special for the occasion, but this issue is, for the most part, business as usual.

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.46

In his latest, Christmas themed post at the blog Ryan talks about some pretty neat API and selector additions introduced by ProcessWire 3.0.46. As always the original post includes more details, but here's a summary of what's new this week:

  • $pages->findIDs($selector) is otherwise like a regular find, but returns an array of IDs instead of actual Pages. If that's what you actually need, this method is going to be much faster than an actual find operation.
    • Note: there's an optional boolean parameter for enabling verbose mode. If and when this is enabled, parent and template IDs will be returned as well.
  • $pages->sort($page, $n) sets the sort value of given page to given integer and also adjusts sort values of sibling pages automatically. If instead of an 0 based integer you provide true as the second param, this method will just rebuild the sort values for the children of given Page.
  • $pages->insertAfter($page, $afterPage) will insert $page right after $afterPage, and $pages->insertBefore($page, $beforePage) will insert $page right before $beforePage. The pages don't need to have the same parent for this to work.
  • Selectors now support negative values for limit and start: limit=-5 will give you five items, but they will be the last five items instead of the first five items, and start=-10, limit=5 will return five items starting from the tenth last item.
  • Selectors now also support a new keyword index, which will return an item at that specific position. You can use index=4 to get the fifth item (indexes are 0 based), index=0 or index=first to get the first item, and index=last to get the last item.

In addition to aforementioned API and Selector updates, there were also some minor usability and scalability improvements and fixes this week, and Ryan also goes on to mention some future updates for the commercial ProDrafts module.

You will find more details about all this on Ryan's latest post at blog, so remember to check that one out too. Thanks!

New module: Select Fields

Select Fields – also known as FieldtypeFields – is a new module by Martijn Geerts. What this module does is actually quite obvious , when you think about it: it stores references to fields, and returns them either as a FieldArray or a regular PHP array of field ID's.

There are potentially quite a few use cases for a field like this, either for allowing users to customize visible content by selecting which fields to display, or simply by making use of this module within another module for configuration purposes etc.

For more details please check out the Select Fields GitHub repository, and if you have any questions about this module, please don't hesitate to post them at the dedicated support forum thread.

New module: PLUs – Page Lister URLs

PLUs or Page Lister URLs is another new module by our module author of the week, Martijn Geerts. The description found from the GitHub repository explains that this module is used for creating run-time links to ListerPages with predefined selector, column and sort settings.

It's worth noting that this module requires the commercial version of Lister, ListerPro, for one simple reason: the Pro version makes it possible to create custom Listers – or ListerPages as they are called here. PLUs, on the other hand, is a helper module that provides a method for creating links to those pages with predefined settings:

// get an instance of PLUs
$plus = $modules->get('ProcessPageListerUrls');

// build a new custom URL
$url = $plus->url(
    $pages->get(1234), // ListerPage
    'template=basic-page', // init selector
    'title!=ProcessWire,>1234', // default selector
    array('title', 'template', 'parent', 'modified'), // columns
    'modified' // default sort setting

For more details about this module and it's possible use cases, check out the PLUs GitHub repository. Again: thanks to Martijn for sharing your work with us, and also thanks to the sponsors of this module, Calago!

Site of the week: Cooking Couple

Our latest site is called Cooking Couple, and yes, you probably guessed right – it does indeed belong to a cooking couple.

The most prominent type of content on this site are recipes, which are divided into four main categories: cooking, baking, BBQ, and snacks. There are also some food-related blog posts and even equipment reviews, so plenty of useful content here for food-lovers.

The responsive layout of this site is based on the Bootstrap front-end framework, and just about every single feature on it feels comfortable to use and well designed. There are various dynamic features, such as the recipe searching / filtering tool, and those make use of the vue.js JavaScript framework combined with the jQuery library.

Comment features are outsourced to Disqus and the feedback form, which itself is built using ProcessWire's built-in form elements, makes use of the Google reCAPTCHA service for robot detection. Makes sense, since both services a) solve a specific problem in an elegant way and b) were designed from the ground up to support seamless integration.

All in all this is another great showcase site, and we've really enjoyed browsing it. Big thanks to the author, Martin Hettiger, for sharing this site with us – great work indeed!

Stay tuned for our next issue

That's it for the 137th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 31st of December. 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!

This post has 4 comments:

Kongondo on Monday 26th of December 2016 22:17 pm

Thanks for the write-up Teppo. Minor typo. In a zero-based index, index=6 should return the 7th item, not the 5th :-)

Teppo on Friday 30th of December 2016 20:57 pm

Thanks, Kongondo! No idea what I was thinking there :D

Martijn Geerts on Tuesday 3rd of January 2017 22:09 pm

Big thanks Teppo!

Martin Hettiger on Saturday 7th of January 2017 19:21 pm

I just found out about this post checking the Google Search Console.
Thank you for choosing our website and for the great write-up Teppo.
Really appreciate it! :-)

Post a comment