ProcessWire Weekly #487

In the 487th issue of ProcessWire Weekly we'll check out the latest core updates, introduce the Template Engine Latte module, and more. Read on!

Welcome to the latest issue of ProcessWire Weekly. In this week's issue we're going to check out what's new in the core this week, as well as share some news regarding current short term core development roadmap.

In other news we're going to take a closer look at the Template Engine Latte module, which is an extension for the popular Template Engine Factory module. And, as always, we've also got a brand-new site of the week to check out; this time that would be the newly launched website of the charity known as Parkinson's Africa.

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

As Ryan mentions in his latest weekly update at the support forum, there have been a few updates to the dev branch this week, but nothing particularly major. As such, we'll likely see a version bump to 3.0.227 next week, and a new merge to the master branch soon as well. This release would include mainly bug fixes and minor optimizations.

Among the updates from this week there were a couple that might be interesting:

  • New $config->versionUrls($urls, $useVersion) method that takes URLs as first argument, adds a cache busting argument (GET parameter) to each, and returns resulting list of URLs as an array. This method can also be accessed from native filename arrays via new urls() method, e.g. $config->scripts->urls().
  • Updates, fixes, and new options for the $datetime->elapsedTimeStr() method: as of the latest dev version, $datetime->elapsedTimeStr($start, [ 'stop' => $stop, 'include' => 'hours minutes' ]) can now be used to specificy what to include in the resulting string.

In addition to a new master release, Ryan is also planning to push out new versions of most of his Pro modules in the next few weeks, so that's definitely something to look forward to.

That's all for our core updates section this week. For more details, be sure to check out the weekly update post from Ryan at the support forum. Thanks!

New module: Template Engine Latte

Template Engine Latte is a third party module created by Philipp Daun. And, just to be clear, this module is not brand-new — it has been around for almost three years, since november 2020. It is, though, a brand new addition to the official ProcessWire modules directory.

Though the name is pretty self-explanatory, what Template Engine Latte does is that it adds support for the Latte templating system for the Template Engine Factory module. Template Engine Factory, as many of you no doubt know, is another third party module that allows one to render pages or individual templates via a template engine (such as Twig or Latte), while also encouraging separation of concerns via an implementation of the MVC pattern.

For those not familiar with Latte, here's a simple example of what Latte syntax might look like:

{if $items->count()}
    <ul>
        {foreach $items as $item}
            <li>{$item->title}</li>
        {/foreach}
    </ul>
{/if}

And here's an alternative version using what Latte calls n:attributes:

<ul n:if="$items->count()">
    <li n:foreach="$items as $item">{$item->title}</li>
</ul>

The Template Engine Latte module provides a few configurable options for tweaking the behaviour of the module:

  • Template file suffix — defaults to "latte", e.g. basic-page.latte.
  • Default layout file — the layout that all views extend by default.
  • Provide ProcessWire API variables in Latte templates — makes ProcessWire's API variables (such as $pages and $input) available in Latte files.
  • Simplified path resolution — enables dot syntax for directory/file traversal, meaning that e.g. {include partials.menu} could now find a file named menu.latte from the partials directory.
  • Auto refresh templates (recompile) — automatically recompile templates when the source code has changed.

If you'd like to give this module a try, you can install it via the modules manager in the admin, clone or download the module's source from the Template Engine Latte GitHub repository, or install it via Composer: composer require daun/template-engine-latte:^1.0). Template Engine Latte requires the Template Engine Factory module, which is automatically installed when installing the module via Composer.

Big thanks to Philipp Daun for creating this module, sharing it with us, and for keeping it up to date. Keep up the great work!

Site of the week: Parkinson's Africa

Our latest site of the week belongs to a company and registered charity called Parkinson's Africa, dedicated to supporting and empowering Africans affected by Parkinson's disease.

The website of Parkinson's Africa was created by Suspire Media, and contains information about the company — actual team doing the work, company history, and so on — and their ongoing programmes. There is also a section of articles covering various aspects of the Parkinson's disease, including living with it, dealing with the symptoms, handling physical exercise, proper diet — and so on.

The design of this site is very clean and quite modern, content is of very nice quality, and navigating the site feels effortless. The filtering tools in the articles section are a very nice touch, and feel like they could easily accommodate much larger amount of content, should the article bank keep expanding.

As for what's happening behind the scenes details, it appears that this site is largely hand-crafted, without the use of a full-blown front-end framework. As for third party ProcessWire modules and such, there's at least one familiar tool at work here — the commercial form building tool FormBuilder.

For more details about this site, check out the Parkinson's Africa journal entry at the Suspire Media website. Our congratulations to the team behind this site for a job well done, as well as the client for their new, ProcessWire powered website!

Stay tuned for our next issue

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