Drupal tips and tricks

The small things that make life easier with Drupal

Drupal-based community site for PHP-GTK

Submitted by Frederic Marand on

The new Drupal-based community site for PHP-GTK is up at http://www.php-gtk.eu.

Drupal features

Technically, this is pretty much a plain Drupal 5.0 Beta 1 Beta 2 RC1 RC2 site, using the new Garland theme without custom changes besides a much needed fix, and a site-specific module for things like useful referer counting and the PHP-GTK dev geolocation service.

PHP-GTK 2 : integrating Drupal e-commerce front-office sites with back-office data

Submitted by Frederic Marand on

As many other developers of e-commerce sites using Drupal, I've had to solve the problem of integrating the "front-office" store maintained in the ecommerce module with the back-office data like the actual invoicing matching legal requirements, tax documents, product ordering from suppliers, and so on, and I've had to choose a toolkit for this.

Until recently I had been using Delphi with XML-RPC to upload content and remotely monitor my sites, but I was looking for a cross-platform solution, and one that would preferably have sources available. Using Kylix for other projects and it *does* work, even with SOAP and remote data stores, but the level of support and lack of upgrades from Borland regarding it left me rather skeptical about using it for new projects. And this was not even taking into account the fact the XML-RPC for Delphi and Kylix is a poorly supported Open Source project. So what ?

Drupal admin: the importance of the sequence, redux

Submitted by Frederic Marand on

Some months ago, I noticed Arnab's blog note about the importance of the sequence table, albeit in a multisite context.

This table also needs special care when copying a drupal site: logically enough, its rows contain the name of the prefixed tables for which a sequence is maintained. For instance, this means that, if you defined the source site as using, say, oldsite_ as a prefix, the name field on the row for the next nid will look like: oldsite_node_nid.

Dokuwiki vs Google

Submitted by Frederic Marand on

For some months now, I've been noticing that the Audean wiki, which I use as a live documentation site for various aspects of my sites, appeared comparatively rarely in Google search results, although it was referenced in various places and Google cache info (cache:-prefixed queries) showed the site was indexed.

Now, the Audean Wiki is based on Splitbrain's Dokuwiki very convenient Open Source wiki, which often appears in relation with Drupal for documentation purposes, and it appears there are three problems with a default Dokuwiki installation, which prevent effective search engine optimization:

Here's how to overturn these hurdles.

How to add settings to custom Drupal themes

Submitted by Frederic Marand on

One feature I used to find missing in Drupal was the builtin ability to have themes include their own settings, like modules do.

For instance, a theme might allow switching renderings on the fly, without needing activation of specific stylesheets, or CSS or code tweaking, just by choosing parameters in an administration UI. But it was impossible. That is, until tonight.

Since a direct implementation in core seemed unlikely to see the day before 4.8/5.0, I created a proof-of-concept module just for this, called "themesettings".

The details and full source are available as a small demo which adds a "background" setting to a variant of the box_grey PHP theme, to define the background color of all nodes on the fly, just by choosing it from admin/themes/settings2/<chosen theme>. To read and download the code involved... :

Speeding up international Drupal versions

Submitted by Frederic Marand on

Would you like your non-english Drupal site to be more responsive ? I just found two-minute hack to speed it up, by a factor of four on the new Riff hosting. Here's how.

While revising devel.module in order to update the french translation, I noticed the queries performed by locale() took on the order of 20ms to be performed, and there are a whole lot of them on most pages when locale.module is enabled.

Since this seemed abnormally slow, I looked at the structure, and saw why. The current MySQL code goes: