Services

  • Drupal CMS Websites
  • Drupal and PHP Developer
  • Custom solutions in PHP/MySQL/jQuery

Welcome

Welcome, I am a Web Developer based in Madrid, Spain originally from the UK. I studied Computer Science & eBusiness at Loughborough University. I specialise in Content Management System websites

Will's Scripts & Functions

Below are some of the snippets of code that I have found useful over the years. Most of them are available and better documented on php.net or respective API sites but I have collected together some of the more common ones that I use or took a long time to find.

 

 

Use the filter form below to filter the scripts and snippets by category...

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Using date popup fields from the date module

I found it hard to find information on how to implement a date field in your forms using the form API. I actually wanted a date popup field. Below is the code for using it

$form['dob'] = array(
  '#type' => 'date_popup',
  '#title' => t('DOB'),
  '#date_format' => 'Y-m-d',
  '#date_year_range' => '-100:+0',
);

You can also find more options here http://drupal.org/node/292667

Using date popup fields from the date module

I found it hard to find information on how to implement a date field in your forms using the form API. I actually wanted a date popup field. Below is the code for using it

$form['dob'] = array(
  '#type' => 'date_popup',
  '#title' => t('DOB'),
  '#date_format' => 'Y-m-d',
  '#date_year_range' => '-100:+0',
);

You can also find more options here http://drupal.org/node/292667

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Drupal 6 pay2publish / Pay per Node

I needed a pay per node solution for Drupal, I was very surprised at the distinct lack of modules for this in Drupal! I have started to port the uc_nodetype module for ubercart but have hit some issues. If anyone is interested in helping me with this, then please let me know.

It mostly works quite smoothly, the only problem I have is trying to display the node edit form on the cart checkout page, it either breaks the page or doesn't show any field elements. It should be such an easy thing but I can't figure it out.

Drupal 6 pay2publish / Pay per Node

I needed a pay per node solution for Drupal, I was very surprised at the distinct lack of modules for this in Drupal! I have started to port the uc_nodetype module for ubercart but have hit some issues. If anyone is interested in helping me with this, then please let me know.

It mostly works quite smoothly, the only problem I have is trying to display the node edit form on the cart checkout page, it either breaks the page or doesn't show any field elements. It should be such an easy thing but I can't figure it out.

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Drupal Views2 - Display all values if no results with exposed filter

I had an issue where I had a google map showing the locations of results, and a filter which helped you zoom in on locations. Basically you typed a location and the map showed the location of the results as well as some listings. However, if there were no results, instead of showing an empty page, I wanted the google map to appear with all results and an error message. What I did was set up an "Empty text" value which called a views function "views_embed_view()", I then created a block within that view but without the exposed filter (actually removing that filter all together).