I have a theme variable $zebracount that increments in my _phptemplate_variables() method in my theme. The theme that I have created styles nodes differently depending on a modulo number (aka my zebracount variable). The trouble is when the call is made to my function mythemename_mediafield_display_1pixelout() theme function, the template variable is no longer accessible.
I am trying to do something like:
/**
* Theme a 1pixelout audio file.
*/
function KimmyZen_mediafield_display_1pixelout($file, $item, $field) {
global $base_url;
//$options = array();
//$options['soundFile'] = check_url($base_url .'/'. $file['filepath']);
if ($zebracount == 1) {
$options = array(
'soundFile' => check_url($base_url .'/'. $file['filepath']),
'bg' => '0xFFFFCD',
'leftbg' => '0xb5bb7d',
'rightbg' => '0xb5bb7d',
'rightbghover' => '0xE5EFF5',
'lefticon' => '0xffffcd',
'righticon' => '0xffffcd',
'righticonhover' => '0xE99030',
'text' => '0x537e53',
'slider' => '0xb5bb7d',
'loader' => '0xfac46c',
'track' => '0xFFFFFF',
'border' => '0x537e53',
);
} else {
// different colors here
$options = array(
'soundFile' => check_url($base_url .'/'. $file['filepath']),
'bg' => '0xFFFFCD',
'leftbg' => '0xb5bb7d',
'rightbg' => '0xb5bb7d',
'rightbghover' => '0xE5EFF5',
'lefticon' => '0xffffcd',
'righticon' => '0xffffcd',
'righticonhover' => '0xE99030',
'text' => '0x537e53',
'slider' => '0xb5bb7d',
'loader' => '0xfac46c',
'track' => '0xFFFFFF',
'border' => '0x537e53',
);
}
$url = $base_url .'/'. drupal_get_path('module', 'mediafield_display') .'/players/1pixelout.swf';
$flashvars = array();
foreach ($options as $key => $val) {
$flashvars[] = rawurlencode($key) .'='. rawurlencode($val);
}
$flashvars = implode('&', $flashvars);
$output = <<<EOT
<object type="application/x-shockwave-flash" data="$url" width="290" height="24" >
<param name="movie" value="$url" />
<param name="wmode" value="transparent" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="FlashVars" value="$flashvars" />
</object>
EOT;
return $output;
}
Can anyone help me with how to have my zebracount variable available in the ..._mediafield_display_1pixelout() function()?
Thanks
Rich
Comments
Comment #1
rl commentedIf you are curious how I solved my issues, try node http://drupal.org/node/192966.
Rich
Comment #2
vm commented