Blog: 2010

Building a WYSIWYG plugin in Drupal

As developers, we usually praise and curse WYSIWYG editors equally. They all suffer from issues, but they're usually better than the alternative - trying to convince clients and content editors to use raw HTML? Not likely!

These usually work with input filters: say for example, you have a YouTube plugin which lets you enter a video ID and embeds the video in the post.

Customising the labels on radio-buttons

Thought I'd quickly blog about this whilst this is fresh in my head!

Sometimes you want to add detail to a set of radio-buttons - e.g. you may want to show an example image below the radio-button's label:

Choose cable connection
( ) VGA
    [ pic of VGA cable ]

( ) DVI
    [ pic of DVI cable ]

( ) DisplayPort
    [ pic of DisplayPort cable ]

Overriding URLs with Drupal panel pages

Hi, My name's Marcus, and I'm addicted to Drupal panels.
(For those of you who haven't come across this wonderdrug before, panels is a layout-engine for Drupal: it lets you add and lay out content, blocks, views and other panels on the page. And it's awesome!)

Panels has a UI which lets you setup new panel pages: e.g. you could add the URL /jobs for your jobs listing page.

A set of system URLs can also be overridden: e.g. node/%node can be overridden to use a panel-page instead of the core node_page_view function.

Anti-virus for Drupal sites

Anti-virus is a subject that's drummed into us continually, bombarded as we are by a constant barrage of infected emails, exploits, attacks on web-servers.

Your server may well be firewalled, patched, protected by strong passwords and all the rest, but many Drupal sites have an attack-vector left wide open: file uploads.

I could use a REST from ModRewrite

I won't enthuse about the virtues of web-services and especially REST - many people have written great articles and presentations before me :-)

One problem irked me: delivering different content on the same URL using a framework.

I'm building a system which stores data about a company.
You visit company/20 and you get a page with data about company 20.
You POST to company/20 and the system saves the new data.

This can make your controller a little fugly:

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  $this->_saveCompany();
}
else {
  $this->_viewCompany();
}

Drupal and Varnish - a quick intro

Varnish is a HTTP accelerator (or reverse proxy) capable of serving 100,000 requests a second. Somewhat faster than Drupal, even with page-caching on!

How does it work?

Diagram of the varnish process, explained in more detail in the list below.

Panels magic

I love unexpected discoveries.

Drupal's Panels module seems to find its way into most of my site builds, along with custom layouts, panel-panes and all sorts of goodness.

I used to declare custom panel layouts this way:

Drupal and the spirit of openness

So what does it take to get accepted around here?
I've started this post to kick off a discussion about the Drupal database abstraction layer, and how to encourage support for other databases.

Overriding language for a Drupal backend

Someone in my DPC Drupal tutorial brought up the topic of multi-lingual sites, and asked how to run the backend of the site in English, when the frontend is in Dutch...

Text in Drupal should run through the t() function, which handles translation. t() checks the global $language variable to choose the target language ($language may be set from user preferences, from a path parameter, from content-negotiation...it will be set automatically).

The solution is to implement an early bootstrap hook - hook_init - to change the language.

Getting Antsy with Phing

Earlier today, I set to work on an open source project...pulled down a copy from github, and started reading through the code.

And there I found a build.xml file.

At first I didn't think anything of it - plenty of my projects have ended up using Ant for setup, builds, CI and other myriad tasks.

Pages

Subscribe to Blog: 2010