Developer Blog



warning: Creating default object from empty value in /var/www/vhosts/mugginsoft/site/drupal/prod/drupal-6/modules/taxonomy/ on line 33.

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).


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.


Exporting PDF as WMF in Illustrator

Posted in:

I had to convert 17 PDFs to the Windows WMF format for inclusion in an Excel worksheet. Illustrator CS3 on OS X does a good job of exporting to the WMF format but a 40KB PDF ballooned into a 348KB WMF.

I reopened the WMF in Illustrator and re-exported the WMF as another WMF. The newly re-exported WMF had a file size of of just 76KB.

My knowledge of Illustrator is very limited so I have no explanations, but it does seem like a useful technique.

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);

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.

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.

Common unix admin commands

Posted in:

Some common unix admin stuff for Fedora 8.

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. CCK (aka the content module) 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.

Syndicate content