Drupal 7 code snippets

Add cron job via cpanel

  1. wget -q -O - -t 1 http://websitesdevelop.com/cron.php?cron_key=iHurtr2QKdghgfKTrcfuvTzQxhglgUuQsMXe6OwfQ &> /dev/null

Cpanel cron job drupal 7

 

setting.php

setting.php placed in sites/default folder, it's main config file of drupal

Display errors via settings.php:

  1. ini_set('display_errors', TRUE);
  2. ini_set('display_startup_errors', TRUE);
  3. $conf['error_level'] = 2;

Turn off the cache:

  1. $conf['cache'] = 0;
  2. $conf['page_cache_maximum_age'] = 0;
  3. $conf['preprocess_css'] = FALSE;
  4. $conf['preprocess_js'] = FALSE;
  5. $conf['views_skip_cache'] = TRUE;

Module and theme development

 

Debug message


  1. watchdog('module_name', 'Debug message @variable', array('@variable' => $your_var));

Using devel module

 
dpm($your_var);
 
dpm() function drupal 7
 

Pure php

 
var_dump($your_var);