Drupal

Drupal on mac OS X using XAMPP with virtual hosts.

Posted in | »

The use of virtual hosts allows us to effectively develop using XAMPP in a way that is similar to final deployment. It also allows for multiple installs of Drupal and permits developing for multiple sites using a single Drupal installation.

In this case we are aiming to set up a development virtual host installation with a URL of www.mugginsoft.local

Submitted by Jonathan Mitchell on Sat, 08/01/2009 - 21:50

Make Drupal 6 View Filter Selection Match View Argument

Posted in | »

The Issue here is that when filtering a Drupal 6 view using an argument the block filter selection does not match the argument.

Submitted by Jonathan Mitchell on Thu, 07/02/2009 - 22:10

Create a Drupal 6 View Block Based on Taxonomy Term

Posted in | »

Your Drupal view can be expressed both as a page and as a block. You can also filter your views content according to a taxonomy term argument. And now you want to generate your block according to the presence of your taxonomy term in your URL (either within a menu path or view search block request generated URI).

Usage

Just call MyViewBlockFromURI() wherever you require it. Stick it in a block if required. Also very handy in the header of a view - you can tie the view header into the content using the taxonomy term extracted from the URI.

Code

Submitted by Jonathan Mitchell on Tue, 06/30/2009 - 11:23

Getting and Setting Cookies in drupal_http_request

Posted in | »

A Drupal 6 http client request is constructed so:

$http_results = drupal_http_request($url, array(), 'GET', NULL, 3);

Some URLs, however, require that a cookie is passed to each request to ensure that a correct response is issued. First, however, the cookie must be retrieved from an initial request.

$http_results = drupal_http_request($url, array(), 'GET', NULL, 3);
$cookie = $http_results->headers['Set-Cookie'];
$headers = array('Cookie' => $cookie);
Submitted by Jonathan Mitchell on Sat, 05/30/2009 - 15:13

Storing Drupal Hierarchy in Subversion

Posted in | »

Often it may prove desirable to push an entire Drupal hierarchy into subversion. The example only provides for local file access.

On Fedora 8 subversion is already installed. To check if installation already present.

rpm -q subversion

Login as root and create subversion root dir and children.

[root~]# mkdir /svndir
[root~]# mkdir -p /svndir/repos
[root~]# mkdir /svndir/users
[root~]# mkdir /svndir/permissions
[root~]# chown -fhR webmaster.apache svndir

Now create repository for our html dir.

Submitted by Jonathan Mitchell on Sat, 05/30/2009 - 13:03

Configuring Outgoing Mail for Drupal with Postfix

Posted in | »

Scenario: Drupal 6 running on a Fedora 8 VPS requiring to send outgoing mail only via a Bluehost mail server.

Submitted by Jonathan Mitchell on Thu, 05/28/2009 - 22:01

Getting the allowed values for a Drupal 6.0 CCK field

Posted in | »

When programmatically creating Drupal 6.0 nodes incorporating CCK fields it may be useful to know the allowed values for the field prior to submitting your form with drupal_execute().

NOTE: the listed function is otiose. Views supplies the required
functionality already.

 
  $content_field = content_fields('field_make');
  $allowed_values = content_allowed_values($content_field);

The following function returns an array of the allowed values for a CCK field.

Submitted by Jonathan Mitchell on Thu, 03/26/2009 - 11:20