Download & Extend

Follow all steps ...but still not showing the slides

Project:Dynamic display block
Version:6.x-1.0-rc6
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

this is the Template.php

<?php
/*!
* Dynamic display block preprocess functions
* Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
* Version 1.1 (11-FEB-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_image_field_image_fid)) {
            // get image id
            $fid = $result->node_data_field_image_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 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('Read more...', 'node/' . $result->nid);
            $slider_items[$key1]['slide_node'] =  '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_image_field_image_fid)) {
            $fid = $result->node_data_field_image_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,
                      $result->node_data_field_pager_item_text_field_pager_item_text_value);
            }
            else {         
              $pager_items[$key1]['image'] =
                '<img src="' . base_path() . $filepath .
                '" alt="' . $result->node_data_field_slide_item_text_field_pager_item_text_value .
                '"/>';    
            }         
          }
          // add pager_item _text variable
          if (isset($result->node_data_field_pager_item_text_field_slide_item_text_value)) {
            $pager_items[$key1]['text'] =  $result->node_data_field_pager_item_text_field_pager_item_text_value;
          }
        }
      }
      $vars['pager_items'] = $pager_items;
    }
  }   
}

_________________________________________________

Sorry but where to find drupal_set_message ? is that the log error?

I follow up the instruction and i build the view and cck with the example u provide in ur website... the template i have changed like above but still the same problem, i have read the most issues and some of them was helpful .. but i still can't see the right resulat...

the ddblock u can see here...

http://goldencatalog.com/node/26073

Comments

#1

I see on your site you use the theme ="/sites/all/themes/bluebreeze/ so the name of your preprocess functions should be: bluebreeze_preprocess_ddblock_cycle....

You can find the drupal_set_message debug lines in the top (line 8 and 9) of both preprocess functions.
You can uncomment them to find out the fieldnames you need to set in the preprocess functions for the fields you use.

Hope this helps you further, please let me know.

#2

*

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

*

stdClass::__set_state(array(
'nid' => '26068',
'node_title' => 'text1',
'node_data_field_pager_item_text_field_pager_item_text_value' => NULL,
'node_type' => 'ddblock_news_item',
'node_vid' => '26068',
'node_data_field_slide_text_field_slide_text_value' => NULL,
'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_revisions_body' => 'TEXT TEXT TEXT 1',
'node_revisions_format' => '3',
'node_created' => '1241210428',
))

*

'news_items'

*

stdClass::__set_state(array(
'nid' => '26068',
'node_title' => 'text1',
'node_data_field_pager_item_text_field_pager_item_text_value' => NULL,
'node_type' => 'ddblock_news_item',
'node_vid' => '26068',
'node_data_field_slide_text_field_slide_text_value' => NULL,
'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_revisions_body' => 'TEXT TEXT TEXT',
'node_revisions_format' => '3',
'node_created' => '1241210428',
))

I think i am step behind the full working Dynamic Block ...Now i get the Gray box and the fading effect is running but the images are in gray... so the last step before success ... Thanks in advanced

#3

You need to change (4x) in the preprocess functions:

node_data_field_image_field_image_fid

into

node_data_field_pager_item_text_field_image_fid

After that you can comment the drupal_set_message debug line again.

And all this without a video tutorial? :)

#4

cool ... it's working without video tutorial u have right.... but the last issue is
i made imagecash preset but the images i uploaded to the page still in the same size???
what can the problem be?

and many thanks ... it's the best thing i have learned in Drupal ... soon i will purchase Advanced Themes from ur site.

#5

I see at your site, that your images for the slide come from imagecache/small/Autumn%20Leaves.jpg.

This is the real size of the image now which is created in the imagecache folder by the image cache module, CSS of the ddblock theme makes it the size you see in the slideshow. (that is why you see your image blurred. CSS blows them up to the size of the slidshow)

If you want to change display sizes you have to change the themes CSS file.

Hope this helps you further, please let me know.

(PS. did you see my comment on your other IE issue on drupal.org)

#6

I deleted the Cash preset now that works fine... i most learn more about imagecash them use it again.. now u said u comment my other issue actually i fixed the problem but forget to close that issue ... i will visit it now

#7

Status:active» fixed

#8

Status:fixed» closed (fixed)

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