Hi,

I create content type ddblock with CCK video and use flowplayer to display video with .flv file video format. Video can display on views and standard page, but can not display on ddblock. how to override preprosess image cck with video cck?
I imported content type and views from Export_files_V1.6.zip.

Many thanks,

Comments

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

You can have a look at the How to make advanced slideshow with embedded video from 3rd party sites. tutorial and the comments below it.

Hope this helps you further, please let me know.

intibiz’s picture

Thanks for your reply,

I use CCK video upload from my own video files and .flv format.
Content type consist of:
- title
- field_video
- field_pager_item_text
- body

I try use this code preprosess on template.php:

if (strtolower(substr($result->node_data_field_custom_pager_text_field_video,0,8))=='<object ') {
  $obj_code = $result->node_data_field_custom_pager_text_field_video;
  $obj_code = preg_replace('/ width\="\d+"/i', ' width="'.$vars['settings']['image_width'].'"', $obj_code);
  $obj_code = preg_replace('/ height\="\d+"/i', ' height="'.$vars['settings']['image_height'].'"', $obj_code);
  $slider_items[$key1]['slide_image'] = $obj_code;
}

Ddblock still can not display video files.

ppblaauw’s picture

Can you uncomment the drupal_set_message debug lines in the content preprocess function and attach the result?
Can you attach your template.php file?
Can you send a link to your Drupal site where the ddblock slideshow is implemented.

Please provide the additional information, so I can help you better.

intibiz’s picture

Title: how to create preprocess_ddblock content CCK video with flowplayer? (Fixed) » how to create preprocess_ddblock content CCK video with flowplayer?
Status: Fixed » Postponed (maintainer needs more info)

I use image CCK and video CCK on content type. If video uploaded, ddblock will video display. If no video upload will use image.

This is preprosess template.php

<?php
function THEME_NAME_preprocess_ddblock_cycle_block_content(&$vars) {
  if ($vars['output_type'] == 'view_fields') {
    $content = array();
    // Add slider_items for the template 
    // If you use the devel module uncomment the following line to see the theme variables
    // dsm($vars['settings']['view_name']);  
    // dsm($vars['content'][0]);
    // If you don't use the devel module uncomment the following line to see the theme variables
     drupal_set_message('<pre>' . var_export($vars['settings']['view_name'], true) . '</pre>');
     drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
    if ($vars['settings']['view_name'] == 'news_items') {
      if (!empty($vars['content'])) {
        foreach ($vars['content'] as $key1 => $result) {
          // add slide_image variable 
          if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
            // get image id
            $fid = $result->node_data_field_pager_item_text_field_image_fid;
            // get path to image
            $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
			
			if (strtolower(substr($result->node_data_field_pager_item_text_field_video_data,0,8))=='<object ') {
			  $obj_code = $result->node_data_field_pager_item_text_field_video_data;
			  $obj_code = preg_replace('/ width\="\d+"/i', ' width="'.$vars['settings']['image_width'].'"', $obj_code);
			  $obj_code = preg_replace('/ height\="\d+"/i', ' height="'.$vars['settings']['image_height'].'"', $obj_code);
			  $slider_items[$key1]['slide_image'] = $obj_code;
			}
            //  use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
            if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
              $slider_items[$key1]['slide_image'] = 
              theme('imagecache', 
                    $vars['imgcache_slide'], 
                    $filepath,
                    $result->node_title);
            }
            else {          
              $slider_items[$key1]['slide_image'] = 
                '<a href="/node/$nid"><img class="portfolio" src="' . base_path() . $filepath . 
                '" alt="' . $result->node_title . 
                '"/></a>';     
            }     		
          }	  
          // add slide_text variable
          if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
            $slider_items[$key1]['slide_text'] =  $result->node_data_field_pager_item_text_field_slide_text_value;
          }
          // add slide_title variable
          if (isset($result->node_title)) {
            $slider_items[$key1]['slide_title'] =  $result->node_title;
          }
          // add slide_read_more variable and slide_node variable
          if (isset($result->nid)) {
            $slider_items[$key1]['slide_read_more'] =  l('<div id="follow"></div>', 'node/' . $result->nid);
            $slider_items[$key1]['slide_node'] =  'node/' . $result->nid;
          }
        }
        $vars['slider_items'] = $slider_items;
      }
    }    
  }
}  
?>

Many thanks before ppblaauw.

ppblaauw’s picture

I had a look at the your Drupal site and the preprocess function for the slideshow.
The images with image cache are working fine, the video not.

The drupal set messages show only the content of the first slide.
Can you change the drupal_set_message line from:

     drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');

to:

     drupal_set_message('<pre>' . var_export($vars['content'], true) . '</pre>');

So also the content of the other slides is shown.

intibiz’s picture

Thank for quick reply,

I've changed drupal_message now..
Please advice this code.

intibiz’s picture

If video uploded, image cache will changed with video display.
Video will display if content type have video upload.

content type field:
- title
- field_image
- field_video
- field_pager_item_text
- body

Thanks for your advice..

ppblaauw’s picture

Can your video field contain multiple videos?
Can you set this to 1.

At my installation I use the object code in the emfield field instead of the URL.

In my code of the preprocess functions I use:

        // add slide_image variable 
        if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
          // get image id
          $fid = $result->node_data_field_pager_item_text_field_image_fid;
          // get path to image
          $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
          //  use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
          if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
            $slider_items[$key1]['slide_image'] = 
            theme('imagecache', 
                  $vars['imgcache_slide'], 
                  $filepath,
                  $result->node_title);
          }
          else {          
            $slider_items[$key1]['slide_image'] = 
              '<img src="' . base_path() . $filepath . 
              '" alt="' . $result->node_title . 
              '"/>';     
          }          
        }
        // add flick_image
        if (isset($result->node_data_field_pager_item_text_field_flickr_image_embed)) {
          $slider_items[$key1]['slide_image'] =  $result->node_data_field_pager_item_text_field_flickr_image_embed;
        }
        // add youtube video
        if (isset($result->node_data_field_pager_item_text_field_youtube_video_embed)) {
          $slider_items[$key1]['slide_image'] =  $result->node_data_field_pager_item_text_field_youtube_video_embed;
        }

In this case:
When the normal imagefield is filled this image will be used.
When the flickr image field is filled the image from flicker will be used.
When the video field is filled (with the object) the video will be used.

In future versions of the ddblock module themed views fields will be used instead of raw data.
Then it is not needed anymore to write the code in the preprocess functions.

Hope this helps you further, please let me know.

intibiz’s picture

I only use one video upload for cck video.
I'm waiting future version.

Thanks for your advice.

intibiz’s picture

I change video preprosess work fine with manual query for theme flowplayer.
This is script code:

<?php
function THEME_NAME_preprocess_ddblock_cycle_block_content(&$vars) {
  if ($vars['output_type'] == 'view_fields') {
    $content = array();
    // Add slider_items for the template 
    // If you use the devel module uncomment the following line to see the theme variables
    // dsm($vars['settings']['view_name']);  
    // dsm($vars['content'][0]);
    // If you don't use the devel module uncomment the following line to see the theme variables
    // drupal_set_message('<pre>' . var_export($vars['settings']['view_name'], true) . '</pre>');
    // drupal_set_message('<pre>' . var_export($vars['content'], true) . '</pre>');
    if ($vars['settings']['view_name'] == 'news_items') {
      if (!empty($vars['content'])) {
        foreach ($vars['content'] as $key1 => $result) {
		
          // add slide_image variable 
          if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
            // get image id
            $fid = $result->node_data_field_pager_item_text_field_image_fid;
            // get path to image
            $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
            //  use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
            if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
              $slider_items[$key1]['slide_image'] = 
              theme('imagecache', 
                    $vars['imgcache_slide'], 
                    $filepath,
                    $result->node_title);
            }
            else {          
              $slider_items[$key1]['slide_image'] = 
                '<a href="/node/$nid"><img class="portfolio" src="' . base_path() . $filepath . 
                '" alt="' . $result->node_title . 
                '"/></a>';     
            }     		
          }
			// add video
        if (isset($result->node_data_field_pager_item_text_field_video_fid)) {
          $fid = $result->node_data_field_pager_item_text_field_video_fid;
          $videopath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
			  $slider_items[$key1]['slide_image'] =  
				'<a href="' .$videopath . '" id="player" class="flowplayer"></a>';
				  flowplayer_add('#player', array(
					'clip' => array(
					  'autoPlay' => FALSE, // Turn autoplay off
					  'linkUrl' => $videopath, // When clicked on
					),
				  ));			  
			}		  
          // add slide_text variable
          if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
            $slider_items[$key1]['slide_text'] =  $result->node_data_field_pager_item_text_field_slide_text_value;
          }
          // add slide_title variable
          if (isset($result->node_title)) {
            $slider_items[$key1]['slide_title'] =  $result->node_title;
          }
          // add slide_read_more variable and slide_node variable
          if (isset($result->nid)) {
            $slider_items[$key1]['slide_read_more'] = l('Continue', 'node/' . $result->nid);
            $slider_items[$key1]['slide_node'] =  'node/' . $result->nid;
          }
        }
        $vars['slider_items'] = $slider_items;
      }
    }    
  }
} 
?>

Thank you.

ppblaauw’s picture

Title: how to create preprocess_ddblock content CCK video with flowplayer? » how to create preprocess_ddblock content CCK video with flowplayer? (Fixed)
Status: Postponed (maintainer needs more info) » Fixed

Thanks for posting your solution, hopefully will be helpful for other users also.
Changed issue title.
Set status to fixed.

Title: how to create preprocess_ddblock content CCK video with flowplayer? » how to create preprocess_ddblock content CCK video with flowplayer? (Fixed)
Status: Postponed (maintainer needs more info) » Closed (fixed)

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