Drupal module not being loaded/called ?

leave a comment »

This is quite frustrating for anybody who is new to drupal/CMS. You have just written a new module and its simply not getting called. The “_init” hook is not working. One can spend hours and hours on debugging this and not arrive at a conclusion.

Well, I did so too and figured that its cause of caching. To make sure while you are working, your code is not getting cached, enable fake Cache in sites/default/settings.php

Here is the piece of code you need to add:

include_once(DRUPAL_ROOT . ‘/includes/cache.inc’);
include_once(DRUPAL_ROOT . ‘/includes/cache-install.inc’);
$conf[‘cache_default_class’] = ‘DrupalFakeCache’;

Once this is set, the page will load with no cache and hence any change you make in the code will get reflected.

Once you are ready for production, you can enable caching in Admin->Configuration->Development->Performance->Caching

Another place to check is the database cache tables:

cache_page  – caches each page request

cache_block – caches modules

You may simply look in this table, delete the entry that you have modified and load it again to check results.

But be careful about cache_form table. It is not really a cache table and emptying it will invalidate all forms on the site.


Written by rationalspace

February 13, 2013 at 4:32 am

Posted in Drupal

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: