Skip to main content

Working with Drupal

Drupal is an open source Content Management System (CMS) built in PHP. It is used by a wide variety of websites from large corporates through to smaller startups. Drupal is hugely flexible which is what makes it such a great framework around which to build almost any type of website. At ComputerMinds we are a Drupal only development house so Drupal is all we do, all day, every day. To find out more about Drupal and how it can work for you have a look at some of our Drupal articles below and feel free to explore our site further to see how ComputerMinds might be able to help you realise your web goals.

Read some of our articles about Drupal

Adding new regions

18th Sep 2007

Adding new custom regions (areas into which you can place blocks) to a Drupal template is dead easy ...

Simply add the following to your template.php file :


function YOUR_THEME_NAME_regions() {
 return array(
  'content_top' => t('content top'),
  'content_bottom' => t('content bottom'),
  'left' => t('left sidebar'),
  'right' => t('right sidebar'),
  'content' => t('content'),
  'header' => t('header'),
  'footer' => t('footer'),
  'new_region1'=>t('A new region')
 );
}

Make sure you change the YOUR_THEME_NAME bit to match the name of your theme (i.e. garland_regions() or computerminds_regions().

You can then reference your new region within the page.tpl using the variable $new_region1(or whatever name you give...

Read more

Drupal 5.2 released

27th Jul 2007

Drupal 5.2 was released last night, containing a couple of quite importants ecurity patches and some other minor bug fixes.

http://drupal.org/drupal-5.2

We will be upgrading our client's sites over the next couple of days

 

Read more

Tinymce and filtered HTML

19th Jun 2007

Just a quick one this - you will probably find that when you use Tinymce and the standard Filtered HTML input format, all your text bunches up and doesn't break correctly.

Once solution to this is to use Full HTML - fine for the admin user but not so good for your average member of the great unwashed.

So, the solution is to goto admin/settings/filters and configure the "filtered HTML" filter. You then want to add

and
to the list of allowed tags.

Everything should now be lovely!

Read more

Modifying the Drupal local tasks to include the destination

17th Jun 2007

There is nothing worse than having your browsing flow interrupted by a login screen that does not return you to your origional destination. Drupal manages to get around this problem by allowing you to append a "destination=XXX" query string parameter to the 'user' login URL.

This is excellent and works well, except what happens if the user clicks the register tab while on the login screen - the destination query string is lost and the user has to resort to the back button.

This little snippet attempts to solve this problem - stick it into your template.php file, it very...

Read more

Getting the drupal captcha module to work

16th Jun 2007

This article applies to the current dev release of both the captcha and the textimage module. It involves modifying captcha.inc file which is distributed with the textimage module - it is therefore only a temporary solution and should be treated with caution!

Step one - download and install.

To get the captcha module up and running you need the following modules

captcha

textimage

form-store

Step two - Turn on form store and form-collect

The form store and form collect modules allow you to build up a "store" of forms used on the site, to which you can then apply captchas...

Read more

Example code to build an upload form in Drupal

27th Mar 2007

Putting together an upload form in Drupal 5 is easier than you think - there are just a couple of things you need to remember ...

The form is built like this:


function build_upload_form(){
    $form['#attributes'] = array('enctype' => "multipart/form-data");
    $form['file_upload']=array('#type'=>'file','#title'=>'Filename');
    $form['submit']=array('#type'=>'submit','#value'=>'Upload file');
    return $form;
}

And the submit is handled like so, note - the value passed into file_check_upload is the name (terminal array key) of the form element defined in your form building function ...


function upload_form_submit() {
    $file = file_check_upload('file_upload');
    //handle the file, using file_save_upload, or something similar
    if ($file){
    $file = file_save_upload($file,'some_path');
    }
}

And thats it...

Read more

Our top tools for developing and debugging with Drupal

20th Mar 2007

It is perfectly possibly to work with Drupal using the free tools that come with Windows, nothing more than notepad and Internet Explorer - but just because its possible doesn't mean its a good idea!

We work with Drupal all day everyday - and rely on a small arsenal of applications to stop us going insane!

1. Firefox - (http://www.mozilla.com/en-US/firefox/ )

Everybody has heard of firefox right? The browser that has MS running scared (and inspired the significant changes in IE7) is great for general browsing - but with a couple of add-ons it becomes the developers best friend.

2...

Read more

Issues with getting TinyMCE to work in Drupal 5

11th Mar 2007

I'll keep this one nice and short - and hopefully save a couple of people participating in a bit of self inflicted baldness!

Installing the TinyMCE module (a nice WYSIWYG editor) in Drupal 5 should be a breeze.

Basically you copy the module into your modules directory. Then hit the TinyMCE site and download the latest version of the TinyMCE javascript/images - which you put into the tinymce directory in your modules directory.

You then enable the module as you would any other.

You now need to ensure you have at least 1 role created - AND ensure that the...

Read more

Drupal cache serves blank page

1st Mar 2007

We inherited another site today, with an interesting problem (actually it has many problems but that's another story). When the Drupal cache is enabled totally blank pages are often displayed. A quick google search fails to bring back much info, so it looks like were going to actually have to work for dinner today :)

Now a blank page is usually a sure sign of a PHP error, the sort of thing that on a dev environment you would resolve in seconds as the message would pop up on screen. No such luck on an inherited production environment. So first...

Read more

Using mod rewrite to stop attempted spam on the emailpage module

28th Feb 2007

We inherited a site that was running a very old (probably un patched) version of Drupal 4.6. The site was getting a massive number of hits to the URL /emailpage - at least 20 a minute, even when there was no other traffic on the site.

This looked suspiciously like a mail header injection problem. Even though the server was not currently sending out any spam we figured that at some point in the past the emailpage module was running un secure, and the site got itself onto someone's spambot list :(.

So what to do. Well first things first...

Read more