RationalSpace

Posts Tagged ‘modules

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.

Advertisements

Written by rationalspace

February 13, 2013 at 4:32 am

Posted in Drupal

Tagged with , ,

%d bloggers like this: