Welcome back to ProcessWire Weekly. For our 85th issue we've got a bunch of core updates, one new module, and a brand new site of the week. Read on!
For our last issue of 2015 we've got plenty of stuff to write about: new core updates from Ryan, a very detailed tutorial for some of the more advanced users by Benjamin Milde, a brand new module by İskender Totoğlu, and more.
At this point we'd also like to wish you all Merry Christmas and a Happy New Year. This has been an interesting year so far, and we've been more than happy to share some of it with you folks. Hope to see you here again next year!
In the meantime our feedback form is open as always. Feedback is always appreciated, so don't hesitate to drop us a line if there's anything you'd like to say. Thanks for being here with us and have a great weekend.
Latest core updates: 2.7.3, 3.0.3, and more!
In his latest blog post, Ryan introduces latest updates for both development branches of ProcessWire, dev (2.x) and devns (3.x). Additionally one of the modules bundled with the system, Comments Manager, has just received major updates – more about that in just a moment!
2.7.3 dev and 3.0.3 devns
While more and more sites are being built on top of the upcoming 3.0 version, 2.7 is still our latest stable release, and we intend to keep it up to date with upcoming changes for the time being. This means that we'll be seeing updates to not one but two branches.
Following updates apply to both 3.0.3 and 2.7.3:
~=operator used for finding pages that contain specific words in any order now supports matching words that are very short or match MySQL's list of stop words.
- API method
$pages->get(), takes a selector string as a parameter, and returns found item. The difference is that now it also behaves like
$pages->find(), skipping over hidden or unpublished pages by default.
- FileCompiler cache can now be cleared using a new button added to the bottom of Modules > Site. While ProcessWire manages cache for compiled template and module files automatically, this is quite handy for testing purposes.
- Other updates include minor improvements to FileCompiler and front-end editor, support for bound parameters in fluent interface calls for DatabaseQuery classes, and built-in cache busting for CKEditor custom config and style files. See commit log for the devns branch for more details.
Following updates, on the other hand, only apply to 3.0.3:
- Fixed an issue where File and Image fieldtypes only supported one textformatter module for file descriptions.
- As suggested by user @er314, the version number of the system itself is no longer displayed on the login screen.
- Added support for a combined average star rating for all comments on a page via the
Major improvements to the built-in comments manager
In our previous issue we mentioned Comments Manager Enhanced, a fork of the built-in Comments Manager module with added support for batch operations. This week similar updates were introduced to the versions shipped with both 2.7.3 and 3.0.3:
- Ability to change how many comments are shown per each pagination page
- Ability to perform bulk actions on selected comments (approve pending, send to spam, delete, change status, and reset upvotes or downvotes)
- "Select all" capability for selecting all visible comments for bulk actions
- Ability to change the sort order that comments are shown in (by date descending or ascending, star rating, upvotes, or downvotes)
- Improved input for stars, now using actual stars rather than numbers
- Improvements to responsive layout for mobile devices and to the user interface and presentation throughout
New advanced tutorial by Benjamin Milde: using custom page types in ProcessWire
Page types represent specialized types of pages with repositories and features of their own. Users, for an example, are a good example of built-in page types. Anyway, even if the whole concept is new to you, don't worry; the tutorial explains the whole concept – including what page types are and how they can be useful – in a lot of detail.
In case you'd like to hear more about this topic, head down to the docs section for an all-new in-depth tutorial experience. Don't let the advanced tag scare you either; while the subject is definitely more suitable for advanced users and use cases, the tutorial itself is very easy to follow and provides various hands-on examples.
This tutorial dives into an often misunderstood or forgotten topic that a lot of projects could've benefited from.. and surely will, now that we have a proper tutorial for it. Huge thanks to Benjamin for your contribution!
New module by İskender Totoğlu provides a fluent API for generating HTML markup
AvbMarkupHtml provides an interesting alternative for those of us keen on avoiding a mixture of HTML and PHP in template files. In a nutshell this module makes it possible to generate HTML markup without writing any actual markup yourself, simply by interacting with a fluent, object-oriented API:
$page->html()->ul()->addClass('list')->children(array( $page->html()->li('Li element value 1')->addClass('list-item')->render(), $page->html()->li('Li element value 2')->addClass('list-item')->render(), $page->html()->li('Li element value 3')->addClass('list-item')->render(), $page->html()->li('Li element value 4')->addClass('list-item')->render(), $page->html()->li('Li element value 5')->addClass('list-item')->render() ))->output(true);
Notice the boolean value `true` given to output method in the end? This is optional and enables the pretty print mode, the code for which is derived from the HTML Formatter project. HTML formatting rules are configurable on a case-by-case basis.
In addition to the purely object-oriented example above, the module also provides a static API:
html::tag('article', array('class' => 'article'))->children(array( html::field('title')->tag('h1', array('class' => 'article-title'))->render(), html::tag('hr:/', array('class' => 'article-divider'))->render(), html::field('body')->render() ))->output(true);
All in all we're really just scratching the surface here with these simple examples. For a more detailed overview of all the API methods and settings available, head down to the AvbMarkupHtml GitHub repository.
While this approach obviously isn't suitable for everyone, AvbMarkupHtml is definitely worth checking out if you'd like to decrease the amount of clutter in your template files. Big thanks to İskender for creating and sharing this module – amazing work as always!
Site of the week: nohe.ch
Our last site of the week this year, nohe.ch, belongs to a Swiss company organizing first aid courses throughout the country.
While first aid is a very important skill in itself, in Switzerland a first aid course is also a requirement for getting a local driver's license – which probably explains why there are partnering driving schools listed at the site. The site also includes course details, introduction to the team, and various detailed pages about getting a drivers license, and so on.
Skilfully crafted by novu, nohe.ch is responsive, visually pleasing, and very much usable regardless of the size and type of device used. We can't say much about what's happening behind the scenes, except that AIOM+ is used for speeding up certain aspects of the site – and it does indeed feel fast and responsive enough.
Thanks to the folks at novu for sharing this site with us, and congratulations to nohe for having such a great site!
Stay tuned for our next issue
That's it for the 85th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 2nd of January. 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!