I've setup a chart here: http://www.concordconserves.org/carbon/chart-test by placing the php code into the page's body field, but when I try and use that exact same code in a node-mycontentype.tpl.php file, I just get a blank white area where the chart should be. I think it is throwing some kind of error which I can't see.

Any idea why it doesn't work in the tpl.php file?

Here's the code for the chart:

<?php

$homeeff=500;
$food=200;
$travel=85;


$example = array(
  '#type'     => 'pie3D', // Display a 3D pie chart
  '#color'    => 'f0f0f0', // Background color, in RRGGBB format
  '#height'   => 290, // in pixels
  '#width'    => 590, // in pixels
  '#title'    => t('Carbon Footprint Breakdown'), // Chart title
  array(
  array('#value' => $homeeff, '#label' => t('Home and Utilities')),
    array('#value' => $travel, '#label' => t('Food and Diet')),
    array('#value' => $food, '#label' => t('Travel')),
   
  ),
);
return charts_chart($example);
?>

Comments

brmassa’s picture

Status: Active » Postponed (maintainer needs more info)

Fletcher,

I dont see any reason for not working, except the fact that node-mycontentype.tpl.php is never called. Can you confirm that something else like "return 'test testing';" return but not the chart?

regards,

massa

gthing’s picture

Did you get this working? I'm having the same problem. Charts will show up in $content or in a block, but not when I add them directly to my theme file.

dhallennem’s picture

same problem.
Why ?

botris’s picture

Use print instead off return?

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

The D6 version of the module is no longer being updated. If this problem exists in the 7.x-2.x branch of the module please reopen.