-
2 weeks 2 days
-
2 weeks 4 days
-
4 weeks 2 days
-
4 weeks 5 days
-
4 weeks 6 days
Drupal module development part 1
Its been 4 days since my last post and it wasn't even related to Drupal. Before I get the feeling of breaking my promise, here's an introduction to module development in Drupal.
In this series of posts, we're going to build a wrapper module for Famspam's facebox jquery plugin. Facebox is a jquery-based lightbox inspired by facebook which is capable of loading images and divs wether its local or remote (via ajax). I'm not really good at explaining things so let me just whet your appetite by showing some screenshots of what we're going to build.
loading the remote google logo loading the user_register form
The above screenshot came from the tests page of the module we're about to build. Also, when I was doing this one.. I have some problems with the image paths for the outline of facebox so I modified them and created a patch so you can apply them yourself. If you don't know how to apply patch, don't worry though because I'll be including the modified version in a tar ball later or if you're feeling a bit geek, you can read more about it here.
To start with, you need to have a working drupal 6 installation. We need to create a folder named "dfacebox" under sites/all/modules to contain all our module's files. If that folder doesn't exist, create it. Inside your dfacebox folder, create two files, dfacebox.info and dfacebox.module. The first one is required for creating modules in D6 (Drupal 6), this contains information regarding our module and the latter contains our actual module codes.
Now download facebox, extract it and apply the patch above. Then copy the whole facebox folder to your dfacebox module folder.
Here's the content for dfacebox.info:
; $Id$
name = Facebox for Drupal
description = A wrapper module for facebox
core = 6.x
The first line is required for CVS - the Version Control System that Drupal uses. Everything is straight forward except for core. Since D6, the core is required, it specifies what version fo Drupal core your module supports.
Now you have an empty module, even if its empty.. we can already enable it so every changes we're going to make will take effect. To enable a module in drupal, just navigate to admin/build/modules and find our module's name, Tick the checkbox and click save. Our module is now enabled, we can now proceed coding but I think this post is getting longer already so we'll just save it for my next post.



Facebook
Twitter
Post new comment