in “ Web development ”,
June 29, 2015.

# Processwire. Light, Powerful, Elegant

When you think of Content Management Systems (CMS), Wordpress, Drupal or Joomla immediately spring to mind; but in the PHP world, there are so many other options! A quick glance at CMS Critic is all it takes to see that the domination of a few big players has not slowed the emergence of a plethora of smaller CMSs: the choices are endless. Over the last few years, some of these CMSs have muscled their way into the market and can now be considered viable alternatives. In this article, I’ll concentrate on Processwire, two-time winner of the Critics Choice Award (in 2012 and 2014). In a later issue, I’ll turn to another popular CMS, Concrete 5.

As I write these lines, Processwire is on version 2.6. Its development is swift, its community is growing. It is now one of the choices offered by Softaculous. On a more personal note, my personal site runs on Processwire, as does my mother’s site, which I developed for her and which she has no problem using at the grand old age of 76. And, since 2012, it is the CMS Critic’s CMS of choice (replacing Wordpress).

This article is merely written for demonstration purposes. I do not claim to know everything there is to know about CMSs, nor do I claim that Processwire is the best of the lot. All I’m saying is that it’s worth a second look. And though all CMS developers will claim the same thing, I have to say it: Processwire’s slogan, Build Bigger, Faster, Stronger, Easier, is right on. And I’d even add this: it’s elegant.

## Ease of Use

The first thing that the uninitiated will appreciate about Processwire is its ease of use. Once connected, the first thing users see is the site map. The examples below are based on my personal website. Its structure is simple, as it is first and foremost a blog, which, granted, I could have built just as easily with Wordpress or Drupal. But my goal here is to describe my experience, not to rank experiences.

Here is the site map:

As you can see, it’s pretty basic, with a home page followed by three main sections. The greyed-out sections are “system sections” only accessible to administrators. And since we’re at the first level, a side-menu (in green) shows the different actions available for the home page. Look at the “Mes textes publiés” section. The number 6 shows that there are six pages of published texts under this section. As for “Promenades”, i.e. the blog portion of my site, the number shows 279 entries. If you click on either one of these sections or sub-sections, you’ll get the same type of menu (note to French users: though this screen capture is in English, a French interface is also available.).

Users are usually very pleased with this introduction to the CMS. Going back to my mother’s site (her interface is in French), you’ll see the same very simple presentation. My mother had no problem quickly grasping the structure of her site.

Now let’s look at the messages available to the CMS administrator. They are usually extremely accessible and readable; in fact, this user-friendliness seems to permeate the system. Depending on their publishing rights, users can access chosen features which are all presented in a straightforward manner. To come back to my site: click on the Falaise link, and notice how the eight pages shown in the site map below are not posted separately but all together within the body of the parent page. This brings me to the programming aspect of the site.

## Ease of Programming

Processwire is predicated on page, page template and field. No need to create new types of content. For example, I placed all critiques of my book, Falaise, under the book page, programming the following in the page template:

<div class="contenu">
<h1><?php echo $page->title; ?></h1> <div id="corps"><?php echo$page->body; ?></div>
<?php
$lesCritiques =$page->children;
if(count($lesCritiques) > 0) {$html = '<h2 class="livre">Quelques réactions</h2 >';
foreach($lesCritiques as$uneCritique) {
$html .= '<div class="critique">';$html .= $uneCritique->body;$html .= '<p class="auteur">';
$html .=$uneCritique->auteur_critique;
$html .= '(' .$uneCritique->date_publication . ')';
$html .= '</p></div>'; } echo$html;
}
?>
</div>

$page is the variable that contains everything having to do with the page (including the reference to its children). I can get the page title by calling$page->title or $page->get("title"). I gathered all the critiques further down in the code. Since critiques were placed under the master page, all I have to do is call its children:$Critiques = $page->children. All I need now is a foreach loop, to obtain each$Critique representing a whole page and possessing its body field ($Critique->body), its author field author_critique, date_publication, etc. Processwire never, ever meddles with code. It will never insert code, unlike Drupal. The programmer or integrator is solely responsible for final code; the foregoing example illustrates that eloquently. ## Pages, Fields, Templates As demonstrated above, Processwire is predicated on the concept of pages. To each page a template. Processwire offers the choice of forcing, or not, the use of templates depending on the context in which the page was created. For example, for books on my site, all you can do is add pages of critiques. Template creation is left up to the programmer’s discretion. These templates group the fields, which are also left to the programmer’s discretion. A single field can be used for several templates. Processwire also offers paying (but inexpensive) powerful specialized fields, like Form Builder, which eases form creation. ### Fields ### Templates ### Fields in a Template ## The API True to Processwire, the API is all simplicity and elegance. Programmers will catch on quickly, and a cursory read of the documentation provided will dispel any doubts they may have. The Processwire syntax is very similar to jQuery’s, with operations being chainable. For example, to obtain the path of the first image on a page of a given width: echo$page->images->eq(0)->width(480)->url;

But we’re just scratching the surface of Processwire’s programming capabilities. For example, this CMS is bootstrappable. Any application can query the CMS to obtain information. Another refinement is the native addition of Hanna programming (known as shortcodes in Wordpress). As always, no need to slog through hard-core programming: just go to the appropriate section and insert your code.

Once again, notice the elegance of the forms and the effort put into explaining to users what to do.

## Something for Everyone

Graphic artists create their HTML pages and CSS confidently in the knowledge that Processwire will not meddle by adding useless and heavy divs. Programmers are happy because they know that all they have to do is insert the template in their code, without having to deal with a controlling CMS. Users are just as happy because if the graphic artist and programmers have done a good job, they enjoy a simple interface, easy-to-fill fields, straightforward image and text manipulation, etc.

## What about the Modules ?

Processwire has a small but growing following of aficionados. Several complementary modules are already available. But this isn’t Wordpress, let alone Drupal. No photo gallery module for Processwire? No problem! Just use one of the many excellent libraries on the Web and integrate it into Processwire. No need to have a module to adapt the solution to the CMS, just use it and that’s it!

## A CMS for all Reasons?

Maybe not. Since nothing is pre-built, some integrators will go for solutions that do more of the thinking for them. But using solutions such as Wordpress or Drupal does not guarantee speedy development. Often, simple is better than overly complex... Don’t forget that the mission of any CMS is to organise content. Its interface is a function of design and programming, and the Processwire developers know this. Too many older CMSs are clunky. Drupal, with all its bells and whistles, is the perfect example. As for Wordpress, as ingenious as it is, you sometimes have to code a long time to reach your ends.

CMSs such as Processwire or Concrete 5 (and others) have the advantage of not having inherited reworked, bloated code. But Processwire can’t do everything. For example, Processwire still isn’t ideal for intranets or community sites with many users requiring access to secure pages (though it is evolving quickly in this regard). Granted, there is an on-line business solution for Processwire, but it is the brainchild of a single person and it isn’t a complete solution. On the other hand, Processwire shines by its flexibility. It is a damned useful, well-thought-out toolbox allowing talented programmers to build personalized sites dispensing with complicated frameworks. The simplicity of its CMS structure makes it easy to grasp and debug, a tour de force in itself. Now that the CMS seems to have hit its stride, I feel confident recommending it to my clients (not to mention my own mother)!

In conclusion, let’s quote the main developer of the CMS.