I've got everything set up and working for a ddblock instance. My only problem is that the cck file field is set up to allow for multiple values. In the view, if I don't select " Group multiple values" for the file field settings, then ddblock creates a slide for each of the images in the cck field. If I do select " Group multiple values", then no images show up and I just get the gray box.

What do I need to do to have ONLY the first image in the cck field show up as a slide in my ddblock?

Thanks for your help.

Comments

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

Can you set "group multi values" and then uncomment the drupal_set_message lines in the preprocess functions for the ddblock slideshow in the template.php file of the theme you use on your Drupal site.

Can you attach the result of the debug lines, to have a look what will be created for the image field.

Are you using the dev version or the RC6 version of the module?

zdean’s picture

Version: 6.x-1.x-dev » 6.x-1.0-rc6

I am using RC6...

Here is the result of the debug lines:

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' => 'view_maintheatre_thumbnail',
  'pager_position' => 'bottom',
  'template' => 'upright40',
  'custom_template' => NULL,
  'view_name' => 'home_main_theatre',
)
stdClass::__set_state(array(
   'nid' => '543',
   'node_type' => 'blog',
   'node_vid' => '543',
   'node_title' => 'A BULGE IN THE FLOOR NOW 100 FEET HIGH',
   'node_revisions_body' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn't take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road. The Road, of course, takes place in a relentlessly grey world, populated only by a father and his son. The anemic duo walks slowly south toward an unidentified coast over mountains and plains, through valleys and dead forests; everything is burned, molten, or obliterated. The father is coughing blood. They meet cannibals and the insane, and they stray into abandoned houses less uninhabited than they seem. The only glimpse we're given of what violently ends the known order of things is this brief scene; I have left McCarthy's original spelling and punctuation intact: The clocks stopped at 1:17. A long shear of light and then a series of low concussions.

He got up and went to the window. What is it? she said. He didnt answer. He went into the bathroom and threw the lightswitch but the power was already gone. A dull rose glow in the windowglass. He dropped to one knee and raised the lever to stop the tub and the turned on both taps as far as they would go. She was standing in the doorway in her nightwear, clutching the jamb, cradling her belly in one hand. What is it? she said. What is happening? I dont know. Why are you taking a bath? I'm not. After this, the landscape outside—everywhere—is described as "scabbed" and "cauterized," heavily covered in ash. McCarthy memorably writes: "They sat at the window and ate in their robes by candlelight a midnight supper and watched distant cities burn."

',
   'node_revisions_format' => '1',
   'node_revisions_teaser' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn't take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road.',
   'node_created' => '1266251285',
))

'home_main_theatre'
stdClass::__set_state(array(
   'nid' => '543',
   'node_type' => 'blog',
   'node_vid' => '543',
   'node_title' => 'A BULGE IN THE FLOOR NOW 100 FEET HIGH',
   'node_revisions_body' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn't take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road. The Road, of course, takes place in a relentlessly grey world, populated only by a father and his son. The anemic duo walks slowly south toward an unidentified coast over mountains and plains, through valleys and dead forests; everything is burned, molten, or obliterated. The father is coughing blood. They meet cannibals and the insane, and they stray into abandoned houses less uninhabited than they seem. The only glimpse we're given of what violently ends the known order of things is this brief scene; I have left McCarthy's original spelling and punctuation intact: The clocks stopped at 1:17. A long shear of light and then a series of low concussions.

He got up and went to the window. What is it? she said. He didnt answer. He went into the bathroom and threw the lightswitch but the power was already gone. A dull rose glow in the windowglass. He dropped to one knee and raised the lever to stop the tub and the turned on both taps as far as they would go. She was standing in the doorway in her nightwear, clutching the jamb, cradling her belly in one hand. What is it? she said. What is happening? I dont know. Why are you taking a bath? I'm not. After this, the landscape outside—everywhere—is described as "scabbed" and "cauterized," heavily covered in ash. McCarthy memorably writes: "They sat at the window and ate in their robes by candlelight a midnight supper and watched distant cities burn."

',
   'node_revisions_format' => '1',
   'node_revisions_teaser' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn't take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road.',
   'node_created' => '1266251285',
))

Thanks for your help

ppblaauw’s picture

Don't see any value for the image field in the result of the debug lines.

Will try and set this up on my testserver.
But this can take a while, first have a project to finish.

zdean’s picture

that's how the output comes out if I enable the "grouping" option. Here is the output with the "grouping" option disabled:

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' => 'view_maintheatre_thumbnail',
  'pager_position' => 'bottom',
  'template' => 'upright40',
  'custom_template' => NULL,
  'view_name' => 'home_main_theatre',
)
stdClass::__set_state(array(
   'nid' => '543',
   'node_data_field_photo_album_field_photo_album_fid' => '4621',
   'node_data_field_photo_album_field_photo_album_list' => '1',
   'node_data_field_photo_album_field_photo_album_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
   'node_data_field_photo_album_delta' => '0',
   'node_type' => 'blog',
   'node_vid' => '543',
   'node_title' => 'A BULGE IN THE FLOOR NOW 100 FEET HIGH',
   'node_revisions_body' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn\'t take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road. The Road, of course, takes place in a relentlessly grey world, populated only by a father and his son. The anemic duo walks slowly south toward an unidentified coast over mountains and plains, through valleys and dead forests; everything is burned, molten, or obliterated. The father is coughing blood. They meet cannibals and the insane, and they stray into abandoned houses less uninhabited than they seem. The only glimpse we\'re given of what violently ends the known order of things is this brief scene; I have left McCarthy\'s original spelling and punctuation intact: The clocks stopped at 1:17. A long shear of light and then a series of low concussions.

He got up and went to the window. What is it? she said. He didnt answer. He went into the bathroom and threw the lightswitch but the power was already gone. A dull rose glow in the windowglass. He dropped to one knee and raised the lever to stop the tub and the turned on both taps as far as they would go. She was standing in the doorway in her nightwear, clutching the jamb, cradling her belly in one hand. What is it? she said. What is happening? I dont know. Why are you taking a bath? I\'m not. After this, the landscape outside—everywhere—is described as "scabbed" and "cauterized," heavily covered in ash. McCarthy memorably writes: "They sat at the window and ate in their robes by candlelight a midnight supper and watched distant cities burn."

',
   'node_revisions_format' => '1',
   'node_revisions_teaser' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn\'t take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road.',
   'node_created' => '1266251285',
))

'home_main_theatre'
stdClass::__set_state(array(
   'nid' => '543',
   'node_data_field_photo_album_field_photo_album_fid' => '4621',
   'node_data_field_photo_album_field_photo_album_list' => '1',
   'node_data_field_photo_album_field_photo_album_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
   'node_data_field_photo_album_delta' => '0',
   'node_type' => 'blog',
   'node_vid' => '543',
   'node_title' => 'A BULGE IN THE FLOOR NOW 100 FEET HIGH',
   'node_revisions_body' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn\'t take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road. The Road, of course, takes place in a relentlessly grey world, populated only by a father and his son. The anemic duo walks slowly south toward an unidentified coast over mountains and plains, through valleys and dead forests; everything is burned, molten, or obliterated. The father is coughing blood. They meet cannibals and the insane, and they stray into abandoned houses less uninhabited than they seem. The only glimpse we\'re given of what violently ends the known order of things is this brief scene; I have left McCarthy\'s original spelling and punctuation intact: The clocks stopped at 1:17. A long shear of light and then a series of low concussions.

He got up and went to the window. What is it? she said. He didnt answer. He went into the bathroom and threw the lightswitch but the power was already gone. A dull rose glow in the windowglass. He dropped to one knee and raised the lever to stop the tub and the turned on both taps as far as they would go. She was standing in the doorway in her nightwear, clutching the jamb, cradling her belly in one hand. What is it? she said. What is happening? I dont know. Why are you taking a bath? I\'m not. After this, the landscape outside—everywhere—is described as "scabbed" and "cauterized," heavily covered in ash. McCarthy memorably writes: "They sat at the window and ate in their robes by candlelight a midnight supper and watched distant cities burn."

',
   'node_revisions_format' => '1',
   'node_revisions_teaser' => '
In a fantastic interview published last year by the Wall Street Journal, novelist Cormac McCarthy—quipping off-hand that "anything that doesn\'t take years of your life and drive you to suicide hardly seems worth doing"—reflects on what might or might not have caused the world-ending catastrophe that frames his recent book The Road.',
   'node_created' => '1266251285',
))
ppblaauw’s picture

Ok, Probably the statement in the preprocess function:

            // get path to image
            $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));

Will return an array of $filepath for all the images in the multiple_image field.

To get only the first image you can probably use:

$filepath[0] to get only the first image

Like below

            //  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[0],
                    check_plain($result->node_title));
            }
            else {          
              $slider_items[$key1]['slide_image'] = 
                '<img src="' . base_path() . $filepath[0] . 
                '" alt="' . check_plain($result->node_title) . 
                '"/>';     
            }          

Same has to be changed for the pager preprocess function.

I did not test this, so hope this works. Please let me know.

zdean’s picture

That didn't work.

I changed the 4 instances of $filepath to $filepath[0] and enabled "Group Multiple Values" in the view.

The ddblock only shows the first slide (no pagers) and the image is just a gray box...just like the behavior I originally reported.

Any other ideas?

Thanks.

ppblaauw’s picture

Do you have a link to the Internet site?
Did you create at least two nodes?

zdean’s picture

I sent you a link through the contact form. And yes, there are at least 2 nodes (they both show up when Group Multiple Values is disabled).

Thanks again.

zdean’s picture

If anyone has any ideas, I'd still appreciate some help on this.

It seems that ddblock doesn't recognize a multi-value field? When I uncomment the drupal_set_message lines in the preprocess functions while "Group Multiple Values" is enabled in the view, the field doesn't show up in the debug lines.

I'd be willing to pay someone to help with this...please help!

Thanks.

ppblaauw’s picture

Status: Postponed (maintainer needs more info) » Active

When you want us to perform this as a paid service, you can fill out the design requirements questionnaire at: http://themes.myalbums.biz/content/design-requirements, to create an efficient work-flow.

zdean’s picture

I'd be happy to do that, but I need to have some idea of how much it will cost and how long it will take.

ppblaauw’s picture

Send you a reply on your submission of the design requirements questionnaire.

ppblaauw’s picture

Title: How do I get a single image from a CCK file field » How do I get a single image from a CCK file field (fixed)
Status: Active » Fixed

For deleting the additional nodes you could add the following code in the preprocess functions to delete them.

//Delete duplicate rows from multiple image fields
//This method uses uniqueness of array key, later values will just override the earlier values
//With array_reverse the first value will be used, without array_reverse, the last value would be used
// With the array_values function the array will be renumbered
// Advantage: quick, disadvantage order of array can be changed.
$newArr = array();
foreach (array_reverse($vars['content']) as $val) {
  $newArr[$val->nid] = $val;   
}
$vars['content'] = array_values($newArr);

The code needs to be placed in the preprocess functions for the slideshow. (both content and pager preprocess functions)

between the lines:
if (!empty($vars['content'])) {
.....
insert code here
.....
foreach ($vars['content'] as $key1 => $result) {

Status: Fixed » Closed (fixed)

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