[[Drupal]]
 

Drupal

Debugging Drupal

When troubleshooting (or developing) in Drupal, it can come handy to display all variables used on the currently displayed page. In order to do this, open up node.tpl.php (within the current theme's directory) and paste in the following snippet at the bottom of the file:

<?php
  print '<pre>';
  var_dump(get_defined_vars());
  print '</pre>';
?>

As with all php-applications the following can be used to display SESSION data:

<?php
  print_r($_SESSION);
?>

Error-warnings in Php 5.3

In order to remove deprecated and strict warnings when running Drupal 6 under PHP 5.3, change line 590 of includes/common to

if ($errno & (E_ALL ^ ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT)) {

Depending on server / webhost it may be necessary to turn off error-reporting alltogether in .htaccess by means of

php_flag display_errors off

When using cheap bastard-hosts (like One.com) this setting might only be able to be changed within their crappy control panel…

Themeing

Blank page for certain content types

Add the following snippet to the top of the page.tpl.php in your theme's folder. Replace ”face” with the appropriate content type

<?php
// $Id: page.tpl.php,v 1.18.2.1 2009/04/30 00:13:31 goba Exp $
if ($node->type == "face" && arg(2) != "edit") {
  print $node->body;
  return;
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Depending on whether you want to use the regular hooks, replace print $node→body; with print($content);

Special uses

 
systems/drupal.txt · Last modified: 2010-03-11 14:54 by Thomas
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki