I try to have images and videos and maybe other stuff in one ddblock. To get to know the functionality of ddblock, I already made all tutorials you have on ddblock.myalbums.biz.

An advanced ddblock slideshow with images works without any problem. But as I added a new ddblock with embedded videos, following the tutorial, the videos don't show up, I have the grey-box-problem. I deleted then all stuff connected with the first ddblock (which I made only for containing images), so the two blocks don't interact, whyever. Well, that did not help.

Then I tried to have videos and images in the same block, so I created another block following the advanced slideshow tutorial. Additionally, I added in views and cck another field to embed videos and made the image field as well as the video field not to be required. The idea is, that one can choose later to take either a video or an image. It was just a try, not expecting to work at all, but I found out that now the images work, but the videos don't. I think, i am not far away from that thing working, that's why I am mentionig it. It seems to me as there is just a little thing to be changed in the preprocess functions?

I haven't changed the preprocess functions so far, except of inserting the theme name. Further, I have deleted all the other tries of ddblocks, their views and the connected cck-Fields. So I think we can handle it as if I installed an advanced slideshow for the first time.

I am sorry if I have overseen an issue or a Faq where exactly that was described, but I am trying to get this thing work for a week now and I am quite annoyed, reading the whole issues and tuts over and over again.

I hope you can help me.

Comments

airen2011’s picture

Status: Active » Postponed (maintainer needs more info)

Can you send your template.php file and the result of the drupal_set_message debug lines when you uncomment them in the preprocess functions, so I can help you better.

A link to the Internet site would also be helpful.

NelsonEC’s picture

Status: Postponed (maintainer needs more info) » Active

Okay, I thought you don't need it as the template is the same as the standard thing. Well, here it is:


// $Id: template.php,v 1.16.2.2 2009/08/10 11:32:54 goba Exp $

/**
 * Sets the body-tag class attribute.
 *
 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
 */
function phptemplate_body_class($left, $right) {
  if ($left != '' && $right != '') {
	$class = 'sidebars';
  }
  else {
	if ($left != '') {
	  $class = 'sidebar-left';
	}
	if ($right != '') {
	  $class = 'sidebar-right';
	}
  }

  if (isset($class)) {
	print ' class="'. $class .'"';
  }
}

/**
 * Return a themed breadcrumb trail.
 *
 * @param $breadcrumb
 *	 An array containing the breadcrumb links.
 * @return a string containing the breadcrumb output.
 */
function phptemplate_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
	return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  }
}

/**
 * Override or insert PHPTemplate variables into the templates.
 */
function phptemplate_preprocess_page(&$vars) {
  $vars['tabs2'] = menu_secondary_local_tasks();

  // Hook into color.module
  if (module_exists('color')) {
	_color_page_alter($vars);
  }
}

/**
 * Add a "Comments" heading above comments except on forum pages.
 */
function garland_preprocess_comment_wrapper(&$vars) {
  if ($vars['content'] && $vars['node']->type != 'forum') {
	$vars['content'] = '<h2 class="comments">'. t('Comments') .'</h2>'.  $vars['content'];
  }
}

/**
 * Returns the rendered local tasks. The default implementation renders
 * them as tabs. Overridden to split the secondary tasks.
 *
 * @ingroup themeable
 */
function phptemplate_menu_local_tasks() {
  return menu_primary_local_tasks();
}

function phptemplate_comment_submitted($comment) {
  return t('!datetime — !username',
	array(
	  '!username' => theme('username', $comment),
	  '!datetime' => format_date($comment->timestamp)
	));
}

function phptemplate_node_submitted($node) {
  return t('!datetime — !username',
	array(
	  '!username' => theme('username', $node),
	  '!datetime' => format_date($node->created),
	));
}

/**
 * Generates IE CSS links for LTR and RTL languages.
 */
function phptemplate_get_ie_styles() {
  global $language;

  $iecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() .'/fix-ie.css" />';
  if ($language->direction == LANGUAGE_RTL) {
	$iecss .= '<style type="text/css" media="all">@import "'. base_path() . path_to_theme() .'/fix-ie-rtl.css";</style>';
  }

  return $iecss;
}
/*!
 * Dynamic display block preprocess functions
 * Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
 * Version 1.6 (01-OCT-2009)
 * Licenced under GPL license
 * http://www.gnu.org/licenses/gpl.html
 */

 /**
 * Override or insert variables into the ddblock_cycle_block_content templates.
 *	 Used to convert variables from view_fields to slider_items template variables
 *
 * @param $vars
 *	 An array of variables to pass to the theme template.
 * 
 */
function garland_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));
			//	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,
					check_plain($result->node_title));
			}
			else {			
			  $slider_items[$key1]['slide_image'] = 
				'<img src="' . base_path() . $filepath . 
				'" alt="' . check_plain($result->node_title) . 
				'"/>';	   
			}		   
		  }
		  // add slide_text variable
		  if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
			$slider_items[$key1]['slide_text'] =  check_markup($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'] =  check_plain($result->node_title);
		  }
		  // add slide_read_more variable and slide_node variable
		  if (isset($result->nid)) {
			$slider_items[$key1]['slide_read_more'] =  l('Read more...', 'node/' . $result->nid);
			$slider_items[$key1]['slide_node'] =  base_path() . 'node/' . $result->nid;
		  }
		}
	  }
	}	 
	$vars['slider_items'] = $slider_items;
  }
}  
/**
 * Override or insert variables into the ddblock_cycle_pager_content templates.
 *	 Used to convert variables from view_fields  to pager_items template variables
 *	Only used for custom pager items
 *
 * @param $vars
 *	 An array of variables to pass to the theme template.
 *
 */
function garland_preprocess_ddblock_cycle_pager_content(&$vars) {
  if (($vars['output_type'] == 'view_fields') && ($vars['pager_settings']['pager'] == 'custom-pager')){
	$content = array();
	// Add pager_items for the template 
	// If you use the devel module uncomment the following lines to see the theme variables
	// dsm($vars['pager_settings']['view_name']);	  
	// dsm($vars['content'][0]);	 
	// If you don't use the devel module uncomment the following lines to see the theme variables
	// drupal_set_message('<pre>' . var_export($vars['pager_settings'], true) . '</pre>');
	// drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
	if ($vars['pager_settings']['view_name'] == 'news_items') {
	  if (!empty($vars['content'])) {
		foreach ($vars['content'] as $key1 => $result) {
		  // add pager_item_image variable
		  if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
			$fid = $result->node_data_field_pager_item_text_field_image_fid;
			$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_pager_item'] <> '<none>'){
			  $pager_items[$key1]['image'] = 
				theme('imagecache', 
					  $vars['pager_settings']['imgcache_pager_item'],			   
					  $filepath,
					  check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value));
			}
			else {			
			  $pager_items[$key1]['image'] = 
				'<img src="' . base_path() . $filepath . 
				'" alt="' . check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value) . 
				'"/>';	   
			}		   
		  }
		  // add pager_item _text variable
		  if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
			$pager_items[$key1]['text'] =  check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value);
		  }
		}
	  }
	}
	$vars['pager_items'] = $pager_items;
  }    
}

The result of the uncommented lines is:



    *

      array (
        'delta' => '1',
        'output_type' => 'view_fields',
        'pager' => 'custom-pager',
        'pager_container' => NULL,
        'pager_event' => NULL,
        'pager_height' => 63,
        'pager_width' => 195,
        'imgcache_pager_item' => '',
        'pager_position' => 'bottom',
        'template' => 'upright30',
        'custom_template' => NULL,
        'view_name' => 'news_items',
      )

    *

      stdClass::__set_state(array(
         'nid' => '36',
         'node_title' => 'one',
         'node_language' => 'en',
         'node_data_field_pager_item_text_field_pager_item_text_value' => 'one',
         'node_type' => 'ddblock_news_item',
         'node_vid' => '36',
         'node_data_field_pager_item_text_field_slide_text_value' => '

      one
      ',
         'node_data_field_pager_item_text_field_image_fid' => '16',
         'node_data_field_pager_item_text_field_image_list' => '1',
         'node_data_field_pager_item_text_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
         'node_data_field_pager_item_text_field_video_embed' => NULL,
         'node_data_field_pager_item_text_field_video_value' => NULL,
         'node_data_field_pager_item_text_field_video_provider' => NULL,
         'node_data_field_pager_item_text_field_video_data' => NULL,
         'node_data_field_pager_item_text_field_video_version' => '0',
         'node_data_field_pager_item_text_field_video_duration' => '0',
         'node_revisions_body' => '

      balh blah
      ',
         'node_revisions_format' => '1',
         'node_created' => '1258943843',
      ))

    *

      'news_items'

    *

      stdClass::__set_state(array(
         'nid' => '36',
         'node_title' => 'one',
         'node_language' => 'en',
         'node_data_field_pager_item_text_field_pager_item_text_value' => 'one',
         'node_type' => 'ddblock_news_item',
         'node_vid' => '36',
         'node_data_field_pager_item_text_field_slide_text_value' => '

      one
      ',
         'node_data_field_pager_item_text_field_image_fid' => '16',
         'node_data_field_pager_item_text_field_image_list' => '1',
         'node_data_field_pager_item_text_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
         'node_data_field_pager_item_text_field_video_embed' => NULL,
         'node_data_field_pager_item_text_field_video_value' => NULL,
         'node_data_field_pager_item_text_field_video_provider' => NULL,
         'node_data_field_pager_item_text_field_video_data' => NULL,
         'node_data_field_pager_item_text_field_video_version' => '0',
         'node_data_field_pager_item_text_field_video_duration' => '0',
         'node_revisions_body' => '

      balh blah
      ',
         'node_revisions_format' => '1',
         'node_created' => '1258943843',
      ))

The site is running only locally, so I can't give you a link yet.

ppblaauw’s picture

Status: Postponed » Active

I can not see the content of your embedded video fields because the debug lines show only the first slide. When your slides are in random order can you reload the page till a slide with data in the embedded video field is show and attach these results.

The code to add in the preprocess functions is probably like below:

For the slide add the following code to the content preprocess function:

        // add youtube video thumbnail
        if (isset($result->node_data_field_pager_item_text_field_video_data)) {
          $data=unserialize($result->node_data_field_pager_item_text_field_video_data);
          if (isset($data['thumbnail']['url'])) {
            $slider_items[$key1]['slide_image'] = '<img src="' .$data['thumbnail']['url'] . 
                '" alt="' . $result->node_data_field_pager_item_text_field_pager_item_text_value . 
                '"/>';
          }
        }

for the pager preprocess function

        if (isset($result->node_data_field_pager_item_text_field_video_data)) {
          $data=unserialize($result->node_data_field_pager_item_text_field_video_data);
          if (isset($data['thumbnail']['url'])) {
            $pager_items[$key1]['image'] = '<img src="' .$data['thumbnail']['url'] . 
                '" alt="' . $result->node_data_field_pager_item_text_field_pager_item_text_value . 
                '"/>';
          }
        }

This is directly copied from the code provided with the embedded video tutorial.
I changed the fieldnames so they are according to the fieldnames you use.

Hope this helps you further, please let me know.

NelsonEC’s picture

Can you tell me exactly where to put these between? If I try to put it in different regions it either happens nothing or the whole site is destroyed.

I changed the order of the Block Content, so the following debug lines should be more informative for you:


    *

      array (
        'delta' => '1',
        'output_type' => 'view_fields',
        'pager' => 'custom-pager',
        'pager_container' => NULL,
        'pager_event' => NULL,
        'pager_height' => 63,
        'pager_width' => 195,
        'imgcache_pager_item' => '',
        'pager_position' => 'bottom',
        'template' => 'upright30',
        'custom_template' => NULL,
        'view_name' => 'news_items',
      )

    *

      stdClass::__set_state(array(
         'nid' => '38',
         'node_title' => 'three',
         'node_language' => 'en',
         'node_data_field_pager_item_text_field_pager_item_text_value' => 'three',
         'node_type' => 'ddblock_news_item',
         'node_vid' => '38',
         'node_data_field_pager_item_text_field_slide_text_value' => '

      three
      ',
         'node_data_field_pager_item_text_field_image_fid' => NULL,
         'node_data_field_pager_item_text_field_image_list' => NULL,
         'node_data_field_pager_item_text_field_image_data' => NULL,
         'node_data_field_pager_item_text_field_video_embed' => '

      TINARIWEN in series: Live At Other Music from Dig For Fire on Vimeo.
      ',
         'node_data_field_pager_item_text_field_video_value' => '3071468',
         'node_data_field_pager_item_text_field_video_provider' => 'vimeo',
         'node_data_field_pager_item_text_field_video_data' => 'a:0:{}',
         'node_data_field_pager_item_text_field_video_version' => '0',
         'node_data_field_pager_item_text_field_video_duration' => '0',
         'node_revisions_body' => '

      srgaeg
      ',
         'node_revisions_format' => '1',
         'node_created' => '1258945798',
      ))

    *

      'news_items'

    *

      stdClass::__set_state(array(
         'nid' => '38',
         'node_title' => 'three',
         'node_language' => 'en',
         'node_data_field_pager_item_text_field_pager_item_text_value' => 'three',
         'node_type' => 'ddblock_news_item',
         'node_vid' => '38',
         'node_data_field_pager_item_text_field_slide_text_value' => '

      three
      ',
         'node_data_field_pager_item_text_field_image_fid' => NULL,
         'node_data_field_pager_item_text_field_image_list' => NULL,
         'node_data_field_pager_item_text_field_image_data' => NULL,
         'node_data_field_pager_item_text_field_video_embed' => '

      TINARIWEN in series: Live At Other Music from Dig For Fire on Vimeo.
      ',
         'node_data_field_pager_item_text_field_video_value' => '3071468',
         'node_data_field_pager_item_text_field_video_provider' => 'vimeo',
         'node_data_field_pager_item_text_field_video_data' => 'a:0:{}',
         'node_data_field_pager_item_text_field_video_version' => '0',
         'node_data_field_pager_item_text_field_video_duration' => '0',
         'node_revisions_body' => '

      srgaeg
      ',
         'node_revisions_format' => '1',
         'node_created' => '1258945798',
      ))

Thank you for the quick answer!

ppblaauw’s picture

You can put the code directly after the if statement to add an image.
Don't insert the <?php and ?> (that is just for highlighting code)

Looks like you don't use youtube video's but vimeo as the provider. Each provider has different ways of handling video's. I only looked at youtube video's in the embedded media field module to use video's from youtube with the ddblock module.

I did not look at other providers.
It takes to much free time now to look at this custom use of the ddblock module at this moment.

NelsonEC’s picture

Status: Active » Postponed

okay, that's comprehensible. I try some further, but it is good to know that it theoretically should work like this. Actually I want to admit that I did not copy the php-tags :-)

Thank you for your support.

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

did you solve your issue?

ppblaauw’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

set status to closed, 8 weeks without activity. Assume poster solved the issue.