Php Blog

Drupal 6: user_badges_taxonomy Module
Last edited on: 15/01/2012 - 22:23

The motivation for this module came from a shortcoming of the functionality of the user_badges module and the thread http://drupal.org/node/1144296 questioning the usage of the vocabulary feature in the user_badges module. It appears that this enables the assignment of badges to users for arbitrary achievements. For instance, a client of mine is a political campaigning organisation and it would be cool to assign badges to those activists who attend campaigns.

»   Read more
PHP Algorithm to Evenly Distribute Items into 3 Columns
Last edited on: 09/11/2010 - 15:27

This is the second time in my PHP career I've needed this so thought I'd commit it to a blog for easy access next time and save myself some brain MIPS. I want to evenly distribute items into three piles, making sure that no pile can have more than 1 extra item, and should a pile need 1 more than the other piles, then the item should go to the left-most first. This is better explained by way of a diagram. My pile of items is shown as letters of the alphabet.

A A
AB A,B
ABC A,B,C
ABCD AB,C,D
ABCDE AB,CD,E
ABCDEF AB,CD,EF
ABCDEFG ABC,DE,FG
ABCDEFGH ABC,DEF,GH
ABCDEFGHI ABC,DEF,GHI

»   Read more
PHP Convert Decimal UK Currency To Pounds Shillings Pence
Last edited on: 02/11/2010 - 09:49

I came across an unusual problem the other day. Whilst developing a PHP book / magazine cataloguing system I wanted to output the cover prices of the items that were pre-decimalisation (1971) in the old UK pounds / shillings / pence format.

For a reminder, particularly for those born later than the mid sixties who will have no recollection of the olden days, the British currency had 12 pennies (d) to the shilling [s] and there were 20 shillings to the pound (£). That makes a total of 240 pennies in a pound.

»   Read more
PHP Zend Framework REST Server Tutorial under Apache + Linux
Last edited on: 18/10/2010 - 07:06

The Zend Framework lends itself to web services due to the bundled classes which come with the Framework. It is ideal both for consuming services (client) and exposing services (server). With this tutorial we'll put together a working REST server using the Framework. If you haven't completed my earlier tutorial on creating a Zend Framework Hello World, you should read it now since we'll be using it as our starting point.

For those who haven't completed the earlier tutorial, make sure you:

»   Read more
PHP Zend Framework Hello World Tutorial under Apache + Linux
Last edited on: 15/08/2010 - 12:49

The following tutorial shows the steps involved in creating a simple Hello World example for the free PHP Zend Framework using Apache server on a Linux openSUSE platform. I am assuming here you are familiar with the concept of the Model-View-Controller (MVC) - if not, click on the link and do some mugging up on Wikipedia.

»   Read more
Drupal 6 SMS Framework: Esendex PHP5 SOAP Gateway
Last edited on: 10/05/2010 - 13:50

Drupal 6 SMS Framework enables the sending of SMS from a Drupal 6 website, through a suitable bureau service. The 'glue' between the SMS Framework module and the chosen SMS bureau is called a 'gateway'. Each bureau needs the development of a dedicated gateway, and currently there are few available. In reality, the only gateways for Drupal 6 are Clickatell and a generic email facility.

»   Read more
Drupal 6 dCaldav Caldav/Webdav Client Module
Last edited on: 23/04/2010 - 18:56

CaldavdCaldavThe sporting fixtures listed on this website under the "Sporting Fixtures" menu item are created automatically using my own Drupal 6 dCaldav module.

»   Read more
openSUSE 11.2: Downgrade PHP 5.3 to 5.2
Last edited on: 23/04/2010 - 10:00

PHP 5.3 is bundled with openSUSE 11.2 which, if you are a Drupal developer, is not a good thing. As of PHP 5.3 the function ereg_replace() is deprecated - and this function is used heavily in Drupal 6 core along with many community modules. I performed the openSUSE upgrade to 11.2, and decided to see what the net result would be with respect to my Drupal development. Drupal generates a load of warnings, most of which are more annoyances than problems, but image_cache doesn't work and I have a dependency on that module so decided to downgrade from PHP 5.3 to PHP 5.2.

»   Read more
Drupal 6 Programmatically Create image_gallery Images in PHP
Last edited on: 23/04/2010 - 09:57

Or since image_gallery items are just images with a taxonomy tag in a vocabulary called Image Galleries, a subtitle could be Programmatically Create Images and Tag with image_gallery. In this tutorial we are going to create a small module which contains the code to create the images and has a button on a form to effect the creation. I will foreground the actual copying code so you can cut and paste it into your own module development.

»   Read more
XML SiteMap Print - A Simple Drupal Module for Beginners
Last edited on: 23/04/2010 - 09:55

One of the problems with Drupal is there are three different Drupal modules that generate sitemaps for your website. So why is that a problem? Well, none of them appear to me to be perfect. Maybe I am using them incorrectly - if so, *PLEASE* let me know so I can correct my comments! The three modules are:

Lets have a look at them in turn.

Site Map

»   Read more