The 154th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
Welcome to the 154th issue of ProcessWire Weekly. This week we're absolutely thrilled to share with you the news that we now have a new stable version of Processwire 3.x. 3.0.61 is our latest stable release, and it includes a whole lot of new and improved stuff. More details about that in a bit!
In other news we have a brand new type of section in this issue: a weekly poll. This is a first step towards the weekly.pw site updates we mentioned a few weeks ago, and we're very keen on seeing how it goes. The first poll focuses on the fundamental features of ProcessWire, but in later issues we're going to dig in much deeper.
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.
Special thanks go to Philipp Urlich for his Pollino module, which we've used for our poll. So far things have been going extremely smooth, and we can definitely recommend this module for any and all poll needs you may have. That being said, please let us know if you notice any issues with this section – it is a new thing for us, after all :)
Latest core updates: new ProcessWire 3.x master version – 3.0.61
In his latest post at the processwire.com blog Ryan introduces a new master version of the 3.x branch of ProcessWire. This version, 3.0.61, replaces our previous stable version, 3.0.42, and contains a downright massive amount of updates and improvements:
- New and updated API methods
$pages->findIDs() for finding the IDs of matching pages, $pages->insertBefore() and $pages->insertAfter() for manually sorting pages, new arguments for both $page->url() and $page->editUrl(), and so on.
- Additions and improvements for Selectors
Negative "limit" and "start" values for selectors, "eq=n" alias "index=n" selectors, InputfieldSelector improvements, and major refactoring and optimization for the Selectors class.
- Numerous improvements for Admin
An all-new dropdown tree navigation for pages, an updated version of CKEditor, revamped alerts and confirm boxes, new page save features, new Admin Theme Framework support, and more.
- Major improvements to Repeaters
Support for depth, new feature for cloning items, support for defining maximum and minimum amounts of items, a delete all feature, and an all-new accordion mode where only one repeater item is open at any given time.
- Various optimizations, bug fixes, documentation improvements, updates to bundled tools and libraries, added hooks – and much, much more!
All in all this is a major update, and we would definitely recommend that you check it out – if you're anything like us, you'll love some of these new features, not to mention that this version also improves both the speed and the overall stability of the system. It's a win-win, so to speak.
Note that what you see above is just a summary of some of the changes in this version. For a full list of changes between 3.0.42 and 3.0.61, please check out Ryan's latest blog post. Thanks!
Weekly poll: what is your favourite feature in ProcessWire?
A couple of weeks ago we mentioned that there were some new features planned for weekly.pw, and the first one is here: a new section labeld "weekly poll". In a nutshell we'd like to ask you folks a single question each week; sometimes it might be about ProcessWire, sometimes other areas of web development.
We're going to kick this section off with a pretty basic question: if you had to name your favourite feature in ProcessWire, what would it be? Don't think about it too hard – just take your pick and you'll get to see what others have answered. If you'd like to provide some background regarding your answer, feel free to do so via post comments.
- Flexible and powerful API (32.8%, 38)
- Easy to use Admin interface (6%, 7)
- Custom fields and data structures (48.3%, 56)
- Markup agnostic output approach (6%, 7)
- Hook system and/or the module architecture (2.6%, 3)
- Technology: performance, scalability, and/or security (3.4%, 4)
- Something else – please let us know via post comments! (0.9%, 1)
Total votings: 116
We hope that this new section is well received, and please let us know if there are any issues with it; it is a new thing for us too. Also any and all suggestions for future polls are more than welcome. Thanks in advance for both your answer here, and any suggestions or feedback you might have!
Recipe of the week: automatically display values of some fields in a template file
Our latest recipe of the week is a ProcessWire Weekly original, though it's admittedly so basic that many of you have probably experimented with something similar yourself, or perhaps even solved it in more elegant ways: displaying field values automatically in a template file, but limiting this behaviour for those fields matching specific criteria.
Let's say that you have a product template, and you want to display certain fields from the template (data structure) automatically on your site. Either you have a lot of such fields, or you may prefer to avoid code changes every time you add a new field.
At the same time you also have fields not intended for public consumption as-is, and fields that may require special treatment or have a special meaning, position, etc. in your template file. As such, displaying all field values is not an option.
There are multiple solutions for this issue, but the one we take here is just about as simple as it gets, and only depends on predefined naming rules for your fields – in other words we're going to prefix the fields we want to become automatically visible.
If, for an example, you have a product template with fields "width", "height", "weight", and "speed", all of which you would like to display automatically in your template file, for the purpose of this example we would actually rename them as "spec_width", "spec_height", "spec_weight", and "spec_speed", respectively.
Then, in the template file, we can do this:
<h2>Product specifications:</h2> <ul> <?php foreach ($page->template->fields as $field): ?> <?php if (strpos($field->name, "spec_") !== 0) continue; ?> <dt><?= $field->label ?></dt> <dd><?= $page->$field ?></dd> <?php endforeach; ?> </ul>
Now we have a list of product specifications, and if we choose to add a new field for a new detail, we can simply add it to the template, name it according to our previously defined naming rule (prefix it with spec_) and be done with it. With this approach you can also add specific rules for some fields or field types, depending on your use case.
Note that instead of a prefix you could also use field tags, but in most cases it doesn't really matter which one you choose. If you prefer to use the same fields for different templates, tags may be a preferable solution, as the field name can be more generic.
If you've got a recipe of your own that you'd like to share with others, feel free to submit it at ProcessWire Recipes. Also, big thanks to all of you who have already shared your knowledge with us – keep up the good work!
Site of the week: TWENTY Kitchen Studio
Our latest site of the week belongs to TWENTY Kitchen Studio. They design and provide furniture mainly for kitchens, but also for other living areas. They are based in Ekaterinburg, which is the fourth-largest city in Russia (according to Wikipedia.)
The language of the site is Russian, the front-end is built on top of the Bootstrap framework, and design wise the site is very clean, modern, and beautiful. Obviously this aspect is more or less a matter of preference, but at the very least it feels like a perfect fit for the company that the site represents.
Forms on the site make use of FormBuilder, which – thanks to the embedding method used – fits the look and feel of the site seamlessly. Other than that, there's not much else we can say about the tech side of the site. One interesting detail is that for web analytics this site makes use of Yandex Metrica, which is a new acquaintance for us.
The site of TWENTY Kitchen Studio was skillfully crafted by Alex Pop. Congratulations to both the author and the client for a very lovely site, and thanks for sharing it with us. That's definitely a job well done!
Stay tuned for our next issue!
That's it for the 154th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 29th of April. 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!