Using .htaccess is one of the best ways to redirect a URL to a new URL. Particular care needs to be taken with Drupal sites for it to work correctly.

The following snippets needs to be added to the root .htaccess file directly after the following lines:

# Various rewrite rules.

RewriteEngine on
.......

See Drupal redirect in .htaccess Snippet

Drupal link function

Blog Post

The Drupal link function is a handy and easy way to create hyperlinks in your module or theme.

Read Drupal link function

New site structure - thinking out load

Blog Post

There are two essential things that I need to do to Be Fused. One is a complete redesign, because I really dislike the current theme. The second is to change the navigation and category structure.

I have been thinking off and on for some time about the best way to categorise the content. I am not happy with the way it works currently, but I don't seem totally happy with the alternatives.

Read New site structure - thinking out load

Find the number of results in a view. Add this snippet to the header or footer of the view, depending on where you want the number of results to be displayed.

From: http://drupal.org/node/131031

See Number of results in a Drupal View Snippet

Drupal Taxonomy vs Content Type Field

Blog Post

Drupal ships with an incredibly powerful and flexible categorisation system, called Taxonomy. However, many developers and site builders get confused when trying to decide if something should be a taxonomy term or a field in its own right.

Read Drupal Taxonomy vs Content Type Field

To move the contents of a directory to a parent directory, first navigate to the child directory and then run the command snippet below.

For example, the parent directory is called "mum" and the child directory is called "baby", navigate to "baby" and run the command. Everything will be moved to the "mum" directory.

This should also work in Linux without any problems.

See FreeBSD move contents of directory to parent directory Snippet

You can use node relativity to attach nodes to other nodes. In this case, I am using it to attach reviews to product nodes, where the reviews are nodes in their own right. I want to be able to view the reviews (children) within the product node (parent).

See Node relativity view childen in parent node Snippet

If you have a live site and a stage (or dev) site, you will probably want to add any new files (such as images) from the files directory on the live site to the staging site, or vice versa.

Run this rsync command, assuming you have navigated to the root Drupal directory (such as public_html). This also assumes that your stage site is located in the stage directory.

See rsync Drupal files directory for staging site Snippet

It is often useful to add a "edit this node" or "edit this block" if a site editor is viewing content on a page that is not the node page itself. This includings viewing content from a "view" page where the normal edit tabs are not present for nodes or blocks.

See Add Edit this node/block link to Drupal View Snippet

Drupal for Publishers notes

Blog Post

This week I attended the Drupal for Publishers event that was held at the Sun Microsystems office in central London. As the name suggests, the event was aimed squarely at publishers. I work for the UK's biggest magazine publisher, so I thought I should attend! I was not disappointed.

Read Drupal for Publishers notes
Syndicate content