contemplate and flash filter modules together?

octavecat - August 24, 2006 - 17:26

Hi,

I have Contemplate module installed, using with Flash Filter and Upload modules. When I create a template for a node using Contemplate, neither of these modules now display content in the node. I have to manually add <?php print theme_upload_attachments($files) ?> to get the attachments listed, and I can't get flash filter to work at all. Is this a bug with contemplate, or is there a different way to force the flash filter module to parse the page for attached flash files, as it would before contemplate was active?

Thanks

Answering

octavecat - August 24, 2006 - 20:18

Answering my own question as seems to be the usual case here :)

For any others who encounter this problem, you need to manually force the flash display.

Because contemplate's template exists for the node, without the ability to pass the $node variable to it, you must adjust things accordingly, and use $files instead of $node->files, etc. Also, $body becomes irrelevant because contemplate doesn't use this, so just insert this wherever you want the flash icon displayed in the template:

<?php foreach ($files as $fid => $file) {
   
$params = _flash_filter_verify_movie_object($file->filepath);
    if (
$params['is_flash'] ) {
       
$files[$fid]->flash_filter = TRUE;
       
$type = ((( variable_get('flash_filter_link_movie', 0) == 0 ) && $params['fits']) ? 'movie' : 'link' );
        print
theme('flash_filter_as_' . $type, $file->filepath, $params);
    }
    else {
       
$files[$fid]->flash_filter = FALSE;
    }
}
?>

 
 

Drupal is a registered trademark of Dries Buytaert.