I spent 6 hours including today and yesterday trying to figure this out.

I want to display a video above the rest of the node display. Thus, I wanted to do it in in page.tpl.php

This never worked. I thought I was doing something wrong but finally I realized that it just did not work.

Thus, I added the HTML to contain the video player in page.tpl.php and called the function from node.tpl.php

Is this a bug?

Comments

alienresident’s picture

Scotthoff,

I added the flowplayer_add function to the node via a preprocess_node function in template.php

You could the flowplayer_add function to the page via a preprocess_page function in template.php

<?php
function MYTHEME_preprocess_page(&$vars) {  
	global $base_url; 
	$video_width = $variables['node']->field_video[0]['data']['width'];
	$video_height = $variables['node']->field_video[0]['data']['height'];        
	if(empty($video_height)){
		/* If there is no height set a default height */
		$video_height = 360;
	}  
	if(empty($video_width)){
		/* If there is no width set a default width */  
		$video_width = 640;
	}
		/* Add the height of the  player to the height */ 
	$player_height = $video_height + 24;            
   
	$filepath =$variables['node']->field_video[0]['filepath'];
	$video_path = $base_url.'/'.$filepath;
	if(!empty($variables['node']->field_video[0]['filepath'])) {
		flowplayer_add('#video-player', array(
		    'clip' => array(  
			  'url' => $video_path,
		      'autoPlay' => FALSE, // Turn autoplay off 
			   'autoBuffering' => TRUE, 
		    ),
		  ));
		$variables['video_player'] = "<a id=\"video-player\" style=\"display:block; width:".$video_width."px; height:".$player_height."px;\"></a>";
 		} else {
		$variables['video_player'] = '';	
		}
	} 
} 
?>    

Note: I am using the video module to create a cck filefield (field_video) and have the video upload module enabled.

On the page.tpl.php add:

<?php print $video_player ?>
yan’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.