Maurits Lawende

First beta release for Rate

Just released the first beta for the Rate module. The Rate module provides flexible voting widgets for nodes and comments.

Screenshot of default Rate widgets

The beta release contains big improvements over the alpha release. One of the major changes are that the widgets in the alpha version uses forms, while the beta release uses links. This was done for better browser compatibility.

GPL icons

Hard to get some GPLv2 icons for use in a Drupal module, but finally found some…

I was looking for this for the Rate module. The Pidgin smileys contains the thumbs up and thumbs down icons and the Ultimate Gnome icon pack contains the star, both used in the default templates for Rate.

Update: Found more information about GPL icons for Drupal.

Building facets in MySQL

One of the great features of using Solr is the facetted search, which is supported by the ApacheSolr module. We can also use this module in custom modules to search via Solr. This has - however - one drawback; it’s not possible to search without any keywords. Let’s say you want to have a list of nodes from a specified taxonomy term, of course with facets from multiple available vocabularies.

I tried a solr query like “tid:202” in the Solr admin. That worked on my localhost, but a colleage reported that it doesn’t work at his machine. But while Solr may support searching without keywords in some way, the apachesolr module does not. The solution for me was to build the facets in MySQL, which was more easy that I thought before.

Custom Term Path

Some of our customers want to have the taxonomy terms linked to the search module instead of the taxonomy page. Especially in cases where the taxonomy pages aren’t themed this is very desirable.

The small module attached provides a new configuration field to the vocabulary add / edit pages where you can fill in a custom path. This path is used for the taxonomy links within the nodes.

Heading Normalizer

I thought of writing a module which can fix the heading usage (H1..H6 tags) in an input filter. The content you write (in a wysiwyg editor or using markdown for example) is generally starting with H1. Sometimes with another heading, but usually something wrong… I am (of course) not the first with this idea. It is already released, and it’s called Heading Normalizer. Surely something which all projects should use. And maybe even something which should be in core.

Caching path aliases

When troubleshooting performance on Drupal websites you may find out that Drupal executes tenths or hundreds of queries per request to get an alias by the internal path. This is done in the function drupal_lookup_path (which resides in includes/path.inc). The query is:

SELECT dst FROM url_alias WHERE src = 'node/3496' AND language IN('nl', '') ORDER BY language DESC

Although this is a fast query, it’s desired to cache those cause they are with many. But there is no solution in core nor a module on drupal.org which can do that. Pressflow - however - can do this. And it is possible to implement this in Drupal.

Hansel breadcrumbs

While working for Dutch Open Projects I have build an interesting module which enables you to customize your breadcrumbs.

We are proud that we have released this module on drupal.org. This module is sponsored by our client NCRV and is already in use at eerstehulpbijrecht.nl.

Rollback using the PostgreSQL rule system

While browsing some old files I came across a SQL file I wrote around 3,5 years ago. It is a kind of time machine in SQL, originally written for a CMS to implement rollback functionality. It is an interesting piece and I still like the approach with only SQL code. It shows that databases are much more than just systems to store your data.

The idea is that it tracks all changes to a database table. Old versions were stored in an archive, marked by date and version number. That provides us with an easy to see when a row was updated. It’s also possible to see what the content was on a given date. I moved this logic from the application to the database. We want to use the table as if it is a regular table without rollback. It saves a lot of time developing the application, and can be implemented quickly on existing applications as well!

Disallow taxonomy pages

A Google search to “image gallery views cck jcarousel” gives my blog as the first result. But it is not the blogpost, but the CCK tag page showing up. The blogpost itself is not indexed at all, likely cause it’s duplicate content.

Drupal did a good job at SEO out-of-the-box. It has a robots.txt which disallows bots to search pages and other pages which could harm your ranking. But it might be a good idea to disallow the tag pages in your robots.txt as well. I have added this yesterday to this site, but it might take a while before it become visible in the Google search results.

How to build an image gallery using CCK, views and jCarousel

Despite the dozens of available modules to create an image gallery, I decided to build it using cck, views, jcarousel, some other modules and one evening. You can see it in action on my image gallery.

The basic idea is that I have one node per album, which contains all images in just one filefield. The node view displays the carousel with the thumbnails, which links to the bigger images using a lightbox. Then I have to make a page displaying the gallery nodes.