nooshu - Matt Hobbs' Web Development Blog

Kneeling on the shoulders of giants

Category: CMS

Posts relating to the use of Content Management Systems; their implementations and plug-ins.

Looking for a new CMS for small websites

Recently I’ve been looking at other small CMS solutions for future projects. For a while now I’ve been using Frog CMS; unfortunately development seems to have stopped which is a shame. At the weekend I stumbled across quite a major security concern with Frog involving a Cross-site request forgery (CSRF). Using Google it is even possible to find ready to be used scripts (which I won’t link to here). Being hacked using CSRF is unlikely to happen as it requires a user who regularly uses the site to click on a rogue link, but even so it’s quite concerning.

Now I could keep using Wolf CMS (which is a variation on Frog) but my thoughts are why keep all your eggs in one basket. If Frog is vulnerable then its likely that Wolf will be too. So time to look about for a new small CMS.

The CMS will be used for very small websites (5 – 20 pages) where MODx, Drupal and WordPress are just overkill; It gets updated regularly and is based on PHP / MySQL. I’ve been having a search and have found a few that look really promising:

Textpattern

Very clean looking CMS (love the typography on its homepage… not that it matters) and having tried the demo I can see the admin interface is simple to use and all the features are easy to find. I think the admin area needs a little work in terms of design, but the comments on Opensourcecms all seem to be very positive so I’ll definatly be installing it locally and having a closer look.

Text pattern homepage

A flexible, elegant and easy-to-use CMS. We shall see!

Concrete5

Another interesting CMS, the video on the homepage makes it look like some sort of action movie, maybe a little over the top but whatever. I was unable to find a live demo of the CMS unfortunately, but the screencasts from the video looked very promising. There’s also an option of Concrete5 hosting the CMS, which removes the (sometimes) tricky setup process; great for non-technical people.

concrete5 homepage

Dramatic homepage video, but how well does it work? Live demo please!

CMS Made Simple

Of the new CMS’ I’ve looked at CMS Made Simple is my favorite. The live demo looked good with a very intuitive administrator area. Some of the comments on Opensourcecms were quite negative; so I’ll have to do some testing of the installation and template system before I commit to building a live site with it.

CMS Made Simple homepage

Some negative comments but it looks very promising.

For my next small project I’ll be using one of these small CMS’, but which one will it be? When i decide I’ll be sure to update you. Got any other suggestions? Why not leave a comment.

New to Drupal? Here are a few helpful links

For the past week or so I’ve been expanding my horizons and started using a new CMS (to me at least), it’s name is Drupal. Now Drupal has been around for many years, originally known as ‘Drop’ until it was renamed to ‘Drupal’ in 2001. The CMS is now on version 6 (with alpha versions of 7 available from the download page). As I’ve only just started using this extremely powerful CMS I thought I’d put together a quick list of links and tips of what I’ve learnt so far. Hopefully other beginners like myself will find them useful.

Screencasts

  • Lynda.com: I can’t stress enough how useful Lynda.com has been while learning Drupal (or any other piece of software for that matter). It has 3 superb sets of screencasts available that will take you from a complete beginner a fairly competent Drupal developer. They aren’t free but they are well worth the money!
  • Learn by the Drop: Another set of brilliant screencasts that you can use to get up to speed on how to use Drupal. The site contains both premium and free videos for the ‘want to be’ Drupal developer.

Websites

  • Stack Overflow: Now I know this is a bit of a catch-all site as it can be used for any programming language, but you will often find many questions you have, have already been answered on Stack Overflow. The Drupal specific questions are available here.
  • Drupal Snippets: Drupal Snippets is a whole site dedicated to…. erm… snippets for Druplal. I must admit I’ve yet to use the site, but I bookmarked it as soon as I found it as I’m sure it will come in extremely useful after learning the basics.

Modules

  • CCK: Download and install this module and developing dynamic websites in Drupal becomes so (so!) much easier. CCK (Content Construction Kit) is a module that expands Drupals native Custom Content Types functionality opening a whole world of possibilities for your site and users. In essence CCK makes it easier to ‘push’ data into your site in any way you see fit. It’s even being included into the core of Drupal 7.
  • Views: Over the past couple of days I’ve been blown away by the power and versatility of the Views module. Where CCK is used to push data into your site database, Views ‘pulls’ the data back out and display it in any format you like. It’s quite intimidating at first as there are tonnes of options and settings, but once you get your head around it, the Drupal world is your oyster. A free screencast on how to use it is available here.
  • Pathauto: Coming from WordPress I’m used to its fantastic permalink functionality, once setup it just works. Drupal doesn’t seem to come bundled with anything similar (please correct me here if I’m wrong!) so installing the Pathauto module will plug that gap. The module automatically generates a path for various content types without you having to worry about it.

Themes

  • Zen: If you are a Front End Developer like myself you will be wanting a solid foundation with which to build and style your site. You could just edit one of the bundled themes if that’s your thing, but I prefer to start a fresh. The Zen theme is a fantastic theme with which to base your styling off. One big tip, don’t edit the main Zen folder, create a sub-theme by following these directions (I learnt that the hard way).

So there you go, hopefully fellow Drupal beginners will find the links above useful. Any that I’ve missed off or that you’d recommend? Leave a comment below.

NextGEN Gallery + WordPress custom fields = happy developer

Over the past couple of weeks I’ve been working on a number of WordPress projects, all of which have needed some basic photo gallery functionality. As I’ve mentioned before in previous posts, NextGEN gallery is my WordPress gallery of choice, there really is nothing that comes close to it in terms of features and customisation (that I know of, if there are others post a comment!).

To add a gallery (or album) to a post / page is as simple as adding ‘[ nggallery id=x ]‘ to the post content… super! One issue though… what happens when you allow a client to edit and add new pages; well what usually happens is the tag gets deleted or changed, the gallery breaks, client panics and the virtual world ends (well not quite, but close). A technique I have been using to help solve this issue involves using WordPress custom fields and the excellent Get custom field values plug-in. You can grab the custom field values directly from WordPress using get_post_meta() but the plug-in makes it much easier.

Digging through the nggfunctions.php file in the NextGEN gallery plug-in folder reveals a whole host of useful functions that can be easily called directly from inside your WordPress theme. So say you wanted a gallery in a post page, but didn’t want the client to have to remember ‘[ nggallery id=x ]‘ every time, simply add this code next to your content in the single.php file:

1
2
3
4
5
6
<?php
    if(c2c_get_current_custom('galleryID') != ''):
        $gID = c2c_get_current_custom('galleryID');
        echo nggShowGallery($gID);
    endif;
?>

Add a custom field of galleryID with an integer value linking to the relevant gallery and you’re done. Now the client can pick out the galleryID custom field from a drop-down since WordPress remembers the custom fields used. Much easier for a client to remember than adding the tag every time.

I highly recommend looking through the nggfunctions.php file, here are just a few functions that are available:

  • nggShowAlbum(): Show a whole album depending on the ID.
  • nggSinglePicture(): Show a single picture from an ID.
  • nggShowRandomRecent(): Show random image(s) from a certain gallery.
  • nggShowSlideshow(): Show a flash slideshow pulling images from a specified gallery.

I have used nggShowRandomRecent() quite a few times in the past few months, here’s a quick example:

1
2
3
4
5
<?php
    //Show 6 random images using 'my-template' from gallery 4
    //(order, number of images, template, gallery ID)
    echo nggShowRandomRecent('random', 6, 'my-template', 4);
?>

Pick 6 images at random from a selected gallery on page load, very simple and effective.

Note: When using the random images function make sure you don’t have any WordPress caching plug-ins running on the selected page, else it won’t work as the page gets cached on first load. It took me a good 15 minutes to figure out why the function had suddenly stopped working due to this slight oversight.

Wolf CMS: A fork of Frog CMS

I’ve written about my Frog CMS usage in previous blog posts; where other CMS’s can be a little overkill for small websites, Frog CMS fits perfectly into the gap. Unfortunately as much as I like Frog, the development seems to have stopped. The last stable version was released on the 26th April 2009, over a year ago. There’s no need to panic though, a development fork has been created called Wolf CMS which is building upon this superb little CMS and making it even better!

At the moment there’s very little difference between Frog and Wolf as you might expect, so migrating from one to the other is fairly simple, a wiki page has been created with instructions on how to do this. As it says on the page it’s probably best to decide between the two versions now since there’s still little difference between them, but this could change in future versions (version 0.6.0 introduced a number of large changes). So there may be a point where it isn’t (easily) possible to jump between the two versions.

So what are the differences at the moment? When version 0.6.0 of Wolf CMS was released on the 1st February it added a new core plug-in called ‘BackupRestore’, allowing admin users to easily backup the Wolf CMS core DB tables. I’ve been using an external plug-in to do this on sites I built, so having this feature added as a core plug-in is nifty addition. Other features include:

  • Admin users can now uninstall plug-ins, including the db tables
  • HTTPS Support added to the admin area for greater security
  • You can now preview a page before it is published

It’s great to see that such a useful little CMS hasn’t been left to stagnate and die out, the roadmap for Wolf CMS looks promising, so fingers crossed it has a bright future ahead of it. I think it’s time to migrate my Frog websites over to Wolf…

More Frog CMS Magic

Over the weekend I was working working on a small website build that required a simple CMS so I decided to put Frog CMS to use again; it continues to impress me. What at first looks like a very simple CMS actually has a powerful API behind it.

First thing I had to do (for my own sanity) was move the layout template outside of the CMS and into an external file. This gives you 2 advantages, you get to use whatever code editor you usually use to edit the template, and the file is then exposed so it can be committed to version control like any other file. It is simple to do with some very basic PHP:

1
2
3
<?php
    include($_SERVER['DOCUMENT_ROOT'] . "/public/themes/yout-theme-directory/layout-template.inc.php");
?>

Paste that code in to your layout with a content type of “text/html” and you are done.

The second code snippet allows you to generate a specific ID and class for every page; great if you need some CSS style / JavaScript hooks on different pages.

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
    if(url_match('/')):
        $bodyID = "home";
    else:
        $bodyID = "page-". $this->slug();
    endif;
   
    if($this->parent() && $this->parent->slug()=="services"):
        $bodyClass = "event";
    else:
        $bodyClass = "";
    endif;
?>

The first if else statement simply sets the home ID to “home” then every other page to “page-slug-name-here” (slug is set in the ‘Meta’ tab). The second one I use on ‘article’ pages; it simply says if the current page has a parent and its parent is the services page add a class of “event”. So now I can style every article page in the same way, and it’s safe for a client to add event pages themselves.

You may ask why the “$this->parent()”; this is to stop the site breaking when you hit the home page since the homepage has no parent, it is the parent of all other pages.