In the 245th issue of ProcessWire Weekly we're going to focus on some new documentation additions made just this week, cover a couple of new third party modules from Bernhard Baumrock, and introduce a magnificent new travel website called Uncover Colombia. Read on!
Welcome to the latest issue of ProcessWire Weekly! In this issue we'll walk you through the latest documentation updates, which focus on elaborating all the different ways in which you, as a developer, can interact with ProcessWire API – and also on highlighting our existing (yet until now rather underdocumented) procedural functions.
We're also going to cover two new modules from the same author, Bernhard Baumrock, and dive into the PHP version poll featured in our previous issue. Finally we've got a new site of the week, belonging to a travel company organising tours at Colombia.
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!
Various ways of accessing the ProcessWire API, and the built-in procedural functions
This week Ryan has been working on expanding and improving the documentation for ProcessWire. As the first results of that work, we now have a new documentation page titled "various ways of accessing the ProcessWire API", and our procedural functions (such as wire, wireDate, wireRelativeTimeStr, wireMail – as well as the features of the Functions API) are now properly included in the API reference at processwire.com.
There's no new core version this week, but some upgrades were made to the $input API variables ($input->get(), $input->post(), and $input->cookie()). We'll cover these in more detail next week, when ProcessWire 3.0.125 is released, but if you're really hasty you can visit the API reference pages or check this commit for more details.
Documenting various ways of accessing the ProcessWire API – a quick look at what's included, and some key takeaways
Various ways of accessing the ProcessWire API is essentially a very detailed walkthrough on where – and how – one would use all the different ways to access ProcessWire's API. If you're reading this and thinking that it's all clear, that's probably a sign that you should most definitely check this page out – even if you're already a seasoned developer, this is a very useful resource, to say the least.
Depending on the context you're currently in, ProcessWire provides multitude of ways to interact with the API: good old API variables (
$page), their functions API counterparts (
page()), the always-available wire function (
wire('page')), the wire API variable (
$wire->page), and of course the property and method type access methods available in all Wire-derived classes, such as modules (
That may sound like a lot to take in, but once you read the docs and understand the context, it's not all that complicated. Or, as Ryan puts it in the documentation page, you may think of switching between different API access methods a bit like changing your own shoes depending on the weather:
> In the same manner, you might have several different shoes that you wear, but regardless of what shoes you wear, you are always the same person. Changing shoes does not cause you to become confused, thinking you are now a different person. You naturally choose different shoes depending on the context, like wearing boots in the snow, or sandals at the pool.
Again, I'd recommend that you check out the documentation for more details. It's quite detailed, and may in fact in the near future be split into multiple content pages, but it's also very informative.
Procedural functions available for the ProcessWire CMS/CMF
The API reference now includes a whole new section dedicated to the procedural way of interacting with ProcessWire. If you're unsure of what this even means, well, in a nutshell this page documents all the functions available once you're working with a ProcessWire site. This page properly documents both the Functions API, and also various helper functions you may or may not have heard of before:
wire()is the always-available way to access ProcessWire's API variables, or the current ProcessWire instance if no arguments are provided.
wireDate()formats a date using PHP date(), strftime(), or other special strings (see arguments).
wireRelativeTimeStr()converts a Unix timestamp into a relative time, such as "3 months ago" or "1 day from now".
wireMail()sends an email using provided arguments, or alternatively sets up a WireMail object for you to populate before sending.
- ... and so on.
There's quite a collection of functions like the ones mentioned above listed at the API reference, split into various categories based on the type of the function in question: common, markup, strings, arrays, Functions API, files, and class helpers.
This is another resource that's definitely worth checking out. Until now many of these features have been mainly documented in posts on the processwire.com blog, but now they're all in one place. Be sure to check them out!
Which PHP versions are ProcessWire users hosting their sites with in January 2019?
Now, our previous issue included a poll asking which PHP versions you're currently using to host your ProcessWire sites on. We'd like to thank all of you who took the time to answer – your feedback is highly valued.
The results of the 2019 PHP version poll are now available, so feel free to check them out in full. For the reference, here are the results from our 2017 PHP version poll – and there's quite a difference there, as you might've guessed already.
To summarise the results of the latest poll:
- Nearly 90% of respondents are using some version of PHP 7, and almost half are using PHP 7.2 or later.
- Nearly 10% of respondents are already using the latest and greatest that PHP currently has to offer, PHP 7.3.
- Only a little over 10% of respondents are still stuck with PHP 5, and basically anything below 5.6 is seeing very little use.
We're quite happy with these results, even if they were not really that much of a surprise: ProcessWire users in general tend to stick with modern PHP versions.
Hopefully these results will give module developers – and perhaps even those making core development decisions – a better idea of their audience, and more motivation to make use of the slightly more advanced features found from modern PHP versions. Overall there are fewer and fewer reasons to support PHP 5, unless you're specifically targeting users who are, for whatever reason, unable to update to a recent release.
Got an idea for new weekly polls, something you'd like to ask ProcessWire users out there? Let us know – we're always happy to convert your suggestions into polls!
New module: RockLESS
Our first new module for this issue is a relatively simple, yet quite useful one called RockLESS: a LESS parser implemented as a ProcessWire module. Built by Bernhard Baumrock, this module provides a simple API for converting regular LESS file on the disk to a browser-readable CSS file.
<link rel="stylesheet" href="<?= $modules->get('RockLESS')->getCSS($config->paths->templates . 'less/theme.less')->cssUrl; ?>" >
getCSS() method returns an object with various properties, including the URL of the CSS file (as displayed in the example above), and the processed CSS as a string. This approach adds quite a bit of flexibility: if you, say, want to combine a bunch of LESS files using this module, that's entirely doable – or if you want to output inline CSS styles, that's no biggie either.
Thanks to Bernhard for sharing this module with us! This is a really useful tool no doubt, and our next module will in fact prove that already ...
New module: RockSkinUikit
Another new module for this issue, and also from the same author, Bernhard Baumrock: RockSkinUikit is a helper module for easily and effortlessly re-skinning ProcessWire's current default Admin Theme, AdminThemeUikit. Bernhard has kindly provided us with a video showcasing the features of his module:
What we see in the video is how once you install this module, you can pretty much just tweak a single color value, and the whole color theme of your admin changes. Part of what makes this possible in the first place is the module we introduced earlier, RockLESS, as it porvides the necessary ability to parse LESS files programmatically.
There are a couple of settings you can tweak, and you can change the logo as well, which basically allows you to easily add custom look and feel without having to worry about those changes breaking things along the way due to theme upgrades and such.
Once again big thanks to Bernhard for sharing his work with us – this is definitely a useful tool, and a valuable addition to our modules repository!
Site of the week: Uncover Colombia
Uncover Colombia is a travel site offering various unique tours of Columbia, allowing you to meet the locals whilst creating holidays of a lifetime. Uncover Colombia was founded back in 2012 by a group of Colombian freinds who, in their own words, "wanted to show foreigners the festive lifestyle, exotic culture and breathtaking natural beauty our country has to offer".
The website of Uncover Colombia was created by London based web design agency Internet Dreams Studio, and it is an amazingly vibrant and colorful experience altogether. The site features lots and lots of beautiful photography, showcasing the best aspects of this magnificent south american country. The site includes a number interesting features as well, ranging from a filterable tour finder to seamlessly integrated tour booking system. There's also a blog on the site, and it appears quite active – definitely check it out if you're interested in hearing more of what to expect of Colombia as a tourist.
Regarding behind the scenes details, we couldn't help but notice that the booking system and newsletter subscription form, both of which fit the site like a glove, are indeed integrated to other systems – we're not entirely sure about the booking system, but the newsletter implementation is powered by MailChimp. The front-end of the site is powered by the Bootstrap front-end framework, and everything from Google Maps embeds to the contact forms have been fully customized to fit the design of the site.
Thanks to the folks at Internet Dreams Studio for sharing their work with us, and congratulations to Uncover Colombia for having what must be one of the most strikingly beautiful travel websites I've seen in a long time – keep up the great work!
Stay tuned for our next issue
That's it for the 245th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 26th 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!
Post a comment