Drupal coder

How to create URL aliases in Drupal without path module

Creating pretty urls or permanent links in Drupal is easy. Really easy. This functionality comes out of the box with the Path module. And by adding the contributed Pathauto module you can make your life easier by letting Drupal generate the pretty urls automatically based on some properties of your post (like the title).

But there's another way of doing this in Drupal. Drupal provides a mechanism in code by means of the custom_url_rewrite_inbound and custom_url_rewrite_outbound functions. Using these wisely may give you some performance gain. Let's see how you can use these.

February 02, 2010Drupal, performance, url rewriting

Drupal 7 multisite improvement : multi-site directory aliasing

Using Drupal's multisite feature, one can use a single codebase for multiple sites. This leaves a smaller footprint and makes your sites more maintainable since you only have to update one bunch of files.

This was already possible in versions prior to Drupal 7 by creating a configuration directory whose name was based on the site's hostname and pathname.

Although easy to setup this was sometimes cumbersome to maintain if you had different copies of your site running on different locations. During the creation of a site, one might typically maintain a development copy, an acceptation copy and a production copy. All these are on different locations. This would lead to creating several versions of the settings directory for one particular site.

In Drupal 7 a solution is provided for this particular problem. A new configuration file is available under the sites folder, called "example.sites.php". Using that file you can set up directory aliases. To see what those are, let's look at a particular example.

January 18, 2010Drupal 7, Drupal, multisite

Configure links on modules overview page in Drupal 7

One of the smaller improvements in Drupal 7 is the addition of "Configure" and "Permissions" for each module in the modules configuration page. For each module we now have quicklinks pointing to the module's configuration page and the correct section on the "permissions" page.

configure-link-drupal7.png

Since we're all working hard now on making our contributed modules Drupal 7 compatible, I wanted to mention here how to make use of this small feature in your own module.
The "permissions" link is added there automatically by Drupal. For the "Configure" link you need to add one more line to your module's info file.

January 18, 2010Drupal 7, Drupal, module development

What's new in Drupal 7 Alpha 1 ?

Yesterday, January 15, 2010 was a big day for Drupal. Our beloved CMS became 9 years old! And boy, did it mature well. To celebrate its birthday, Webchick (Angie Byron), Drupal 7's maintainer released the first alpha version of Drupal 7.

Since a lot of people are wondering what's new in version 7, I decided to gather a list where you can find this out.

January 16, 2010Drupal 7, Drupal

Overriding CSS stylesheets in Drupal themes

Some modules do provide their own CSS files. Themers might not always like what's happening in there and want to provide their own styles. You can remove the file (using preprocessing) or you can just replace the file with your own in your theme.

An example? Take the link module, which adds a link field type to CCK. This module has provides a CSS file : link.css. Suppose you have uploaded your module at sites/all/modules/contribute/link, we now have a file sites/all/modules/contribute/link/link.css.

January 13, 2010Drupal, theming

drupalcoder.com is a blog on all things Drupal in specific and LAMP on OS X in general. It is maintained by Davy Van Den Bremt, a Belgian (Drupal) web developer and designer living in Ghent. The goal of this blog is to log all interesting things that have crossed the writer's path while developing Drupal sites. You can read all about Davy's professional activities on his LinkedIn profile. If you want to get in touch, use the contact form.