Open/close side menu
C.C. Hogan

Creating my book websites with Processwire

Comment on this article

A little bit of web development is good for the soul

(See also: Creating a single template blog with Processwire and Hanna Code)

I dabble with web things. Messing with the intraweb, the little HTML thingies that get stuffed in page sort of thingies and so on. It is rather fun.

I have used all kinds of systems over the years - PHP Nuke (bit formative that), Mambo, Joomla, Word-depress.  Basically all the usual suspects and, to be honest, I hated them all.

The problem is that sometimes sitting and writing a bit of HTML/CSS or using a system like Dreamweaver is not just more powerful and versatile, but simpler too. What I have always wanted was a system that gave me the update ease of a Content Management System, but let me put the site together, the shape, look and feel, like I would with a bit of basic coding.

Along trots Mr Processwire (or Ryan Cramer, to be fair, but I like Mr Processwire).

Now, a lot of people say a lot of good things about PW, and they are all completely right.  It is powerful, the API is deep, clever and sensible and the back end is rock solid. But that was not what attracted me to the system. What I liked was that I did not have to learn a templating language.  I could just write HTML.

This is roughly how it works.

  1. You create a "template" in the Processwire admin. This is not a looky-feely thing, but basically a structure for any page you want to create. 
  2. You add fields to the template. Title, couple of text fields, image fields, anything you like.
  3. You create a new page as a child of the Home page and you select the template.
  4. You publish.

Right.  You now have a page, the address to which is something like mlovelywebsite.me/mypage/

But you cannot see anything.  This is because you haven't written any html, fool! This is a website - it needs HTML!

So. Open up your directories and go to /site/templates/

This directory is, for all intents and purposes, like your web root if you were writing a static site. Forget the techy why, it just is.

Create a file with same name as the template.  So if you called your template my-nice-little-template, create a file called my-nice-little-template.php.  Actually, you can associate any file with any template, but for the moment this is easier.  Oh, easier still, create the file FIRST, then create the bloody template. Then it will actually offer it to you.

Save it.

Run back to the admin, go to setup, templates and edit the template you made earlier.  If you go to URLs, you will see that it is now using your template file.  NOTE:  templates and template files - two different things doing two different things.  One is for creating pages, the other is for DISPLAYING them.

Open your template file and write ordinary HTML. 

Where you want a field to display, add a tiny bit of PHP and the PW API stuff.  Terribly complicated this:

<h1><?php echo $page->title; ?></h1>

That will display the title field.

That is it. You can now go off and design a website! You can use any CSS framework you like, straight out of the box. Use any JQuery, javaScript, Perl, anything you like. Again, just as supplied. You do NOT have to have a special PW version, you don't have to do anything different to you would do if this was a static site.

Oh, one thing: When you reference JS or CSS files, then you need to point them at the correct directory.  I put my CSS in a directory called css within the template directory. I put my structural images in a directory called images ... you get the idea.  All I do is rather than add the full path, I put 

<link rel="stylesheet" href="<?php echo $config->urls->templates?>css/site.css" />

Processwire does the rest.

Does it get more complicated?

Yes, but only in so far as you want to do something complicated.  For instance, if you want to loop through all the children of a page, you need to use a little php foreach to do it.

The Processwire API is very, very powerful and has a huge amount of very simple phrases that dig out your data from your pages for you.

But, and this is very important, it does very, very little formatting. For most fields it does none. So the only HTML and CSS you have to fight with is anything you add yourself.

You do need to know some basic PHP and anyone who knows JQuery will recognise what inspired the PW API, from a linguistics point of view, but even a non-dev should be able to put something together very quickly.

However, if you are rubbish at HTML, then your site will be rubbish.

Processwire does not come with pre-made themes for the front end of your site. Indeed, the simplest install only comes with a couple of fields and one template - the one for your home page. So, if you are looking for acres of themes to browse and download, forget it.

But then, that is not what PW is for. It is for people who have their OWN design ideas, their OWN wants and lists of requirements and do not want to be pigeon-holed by someone else.

Pros and Cons

The cons, such as they are, are really as I have just said.  If you are looking for plug and play, not just for the back end, but for the front end, don't go to Processwire - you will have to suffer Wordpress and its constant security updates.

It does not have a huge resource of thousands of plugins (called modules in PW) basically because it doesn't need them. Most of the modules are backend functionality for retrieving data in a certain way, or for creating specific types of data, but you will not find a hundred slideshows - just go grab something from the internet and integrate it.

Because of this, PW does not suffer from the security hangups that WP gets from third party plugins - which will be a relief.

Actually, this also applies to the core. If you develop a PW site and never need to change the functionality, there is no pressing reason to update to the latest version of PW if you do not want to.

You cannot really compare systems such as Processwire (which is both a frame work and a CMS) to things like Joomla, because they are completely different animals, often aimed at different sorts of users.

Having said that, this site, CC Hogan, is a blog. It has all the blog functionality you would expect and a seriously powerful SEO site - basically, because I wrote it all in myself. (Lots and lots of fields - it wasn't hard).  So, it is doing everything Wordpress can, but is doing it the way I want it to.

A World Called Dirt is a book publicity site with a huge encyclopaedic resource called the Abbey.  It was as easy to construct as this site was. I didn't have to bend or break anything to my will, I just had to build it in a shape that made logical sense.

Processwire is also blindingly fast on the backend and has a premium caching system called Procache which is inspirational.  However, don't want to spend the money? Well, the inbuilt cache is pretty hot too.

The only two things that slow my site down are predictable network problems and occasionally my own silly coding.

So, there you go, bit short of Cons, but as I said, I am looking for something where I can write my own HTML and CSS and not have to learn any strange illogical way of doing it. So Processwire fits my criteria perfectly which means that finding cons will be problematical. If you are looking for a theme-based, multi add-on CMS, then you will probably think of loads of cons - none of which would worry me, since I am not.

Processwire is available free from Processwire.com.  They have an incredibly active community on the forums who pride themselves on never leaving a post unanswered. They are even rather nice and polite, if occasionally silly...

 

Comments

Please feel free to comment - no anger, no bad vibes, no trashing people. Just sit around, enjoy a flagon of beer and mull over the world. You can login with Disqus, Facebook, Twitter or Google.

Series One & Two are out now!

Start series one with Dirt for Free, and start reading the brand new series two with Girls of Dirt for only 99p!

Girls of Dirt includes a recap of series one.

Get it now at the Dirt website

The Stink Is Here

North London, 1976. The longest, hottest summer on record. The water is running out and the kids hate their parents. Which bunch of idiots would think it is a good idea to start a band?

The Stink

Visit The Stink Website