Please help me. I followed the tutorial to make an advanced ddblock slideshow. I didn't get any errors...except at the end, I don't have a slideshow. Where the slideshow should be, I have all of the photos and text in a blob. All of them are displaying at once--there is no animation or theme.

I uploaded the custom directory into my theme folder and added the preprocess code into the template.php file. It almost seems as though this code isn't being picked up at all and I don't know why. The only thing I can think of is that in my themes folder is in home_directory/themes instead of in home_directory/sites/all/themes. Would this affect it?

CommentFileSizeAuthor
#10 Picture 3.png457.17 KBedk86

Comments

ppblaauw’s picture

Version: 6.x-1.0-beta » 6.x-1.0-rc6
Category: task » support
Status: Active » Postponed (maintainer needs more info)

Could you attach your adjusted template.php file and the result of the drupal_set_message lines when you uncomment them in the preprocess functions.

A link to the site would also be helpful.

It should not matter that the theme is in the original theme folder although it is recommended with drupal to place your customized theme in sites/all/themes ( for upgrading purposes) See a also the readme.txt at sites/all

edk86’s picture

Thanks for the quick response. I realized I was using the wrong block--the "news item slideshow" instead of the instance. But the instance is not showing up at all.

ppblaauw’s picture

Yes, you need to place the ddblock instance in a block or a node instead of the news_item_slideshow block from the view.

What did you do with the instance?
Where do you expect to find the instance and what is different?

Still the same request as in #1 are valid, to help you better.

edk86’s picture

I tried putting the instance in both a block and node. Neither showed anything at all, not even a blank space.

here's my template.php file (my theme is called "mytheme"):

<?php
// $Id: template.php,v 1.5 2009/01/29 14:32:52 troy Exp $

function phptemplate_preprocess_page(&$vars) {
  $defaults = array(
    'admin_left_column' => 1,
    'admin_right_column' => 0
  );
  
  global $theme_key;
  // Get default theme settings.
  $settings = theme_get_settings($theme_key);    
  $settings = array_merge($defaults, $settings);
 
 
  
  if (arg(0) == 'admin' && ($settings['admin_right_column'] == 0) && !(arg(1) == 'build' && arg(2) == 'block')) {
    $vars['right'] = '';
  }
  
  if (arg(0) == 'admin' && ($settings['admin_left_column'] == 0) && !(arg(1) == 'build' && arg(2) == 'block')) {
    $vars['left'] = '';
  }
  
  $vars['registration_enabled'] = variable_get('user_register', 1);
  $vars['closure'] .= '<span class="developer">
<strong><a href="" title=""></a></strong>          <span class="version"></span>
</span>';
}

function phptemplate_pager_last($text, $limit, $element = 0, $parameters = array()) {
  global $pager_page_array, $pager_total;
  $output = '';
$view_path = "frontpage";  // Change to reflect yours views actual path
if ( arg(0) != $view_path ) {
  // If we are anywhere but the last page
  if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
    $output = theme('pager_link', $text, pager_load_array($pager_total[$element] - 1, $element, $pager_page_array), $element, $parameters, array('class' => 'pager-last'));
  }

  return $output;
  }
}


/**
 * Generate the HTML representing a given menu item ID.
 *
 * An implementation of theme_menu_item_link()
 *
 * @param $link
 *   array The menu item to render.
 * @return
 *   string The rendered menu item.
 */
function phptemplate_menu_item_link($link) {
  if (empty($link['options'])) {
    $link['options'] = array();
  }

  // If an item is a LOCAL TASK, render it as a tab
  if ($link['type'] & MENU_IS_LOCAL_TASK) {
    $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>';
    $link['options']['html'] = TRUE;
  }

  if (empty($link['type'])) {
    $true = TRUE;
  }

  return l($link['title'], $link['href'], $link['options']);
}

/**
 * Duplicate of theme_menu_local_tasks() but adds clear-block to tabs.
 */
function phptemplate_menu_local_tasks() {
  $output = '';

  if ($primary = menu_primary_local_tasks()) {
    $output .= '<ul class="tabs primary clear-block">' . $primary . '</ul>';
  }
  if ($secondary = menu_secondary_local_tasks()) {
    $output .= '<ul class="tabs secondary clear-block">' . $secondary . '</ul>';
  }

  return $output;
}


/*!
 * Dynamic display block preprocess functions
 * Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
 * Version 1.5 (27-JUL-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 mytheme_preprocess_ddblock_cycle_block_content(&$vars) {
  $settings = $vars['ddblock_slider_settings'];
  // for showing debug info
  ddblock_show_content_debug_info($vars);
  if ($settings['output_type'] == 'view_fields') {
    if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
      if (!empty($vars['ddblock_content'])) {
        foreach ($vars['ddblock_content'] as $key1 => $result) {
          // add slide image variable
          $slider_items[$key1]['slide_image'] = ddblock_add_image(
            $vars,
            // determines which imagcache preset to use, leave to 'slider_item_image'
            'slider_item_image',
            // name of CCK generated image field, change if needed.
            $result->node_data_field_pager_item_text_field_image_fid,
            // alt attribute of image or NULL
            $result->node_title,
            // cck content type for default image or NULL, change if needed
            NULL, //'ddblock_news_item',
            // cck fieldname for default image or NULL, change if needed
            NULL, //'field_image',
            // to link the image to or NULL, change if needed
            NULL //'node/' . $result->nid
          );
          // 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'] = '<a href="/node/' .  $result->nid . '">' . t('Read more') . '</a>';
            $slider_items[$key1]['slide_node'] =  'node/' . $result->nid;
          }
        }
      }
    }    
    $vars['ddblock_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 mytheme_preprocess_ddblock_cycle_pager_content(&$vars) {
  $settings = $vars['ddblock_pager_settings'];
  // for showing debug info
  ddblock_show_pager_debug_info($vars);
  if (($settings['output_type'] == 'view_fields') && 
      ($settings['pager'] == 'number-pager' || 
      $settings['pager'] == 'custom-pager' || 
      $settings['pager'] == 'scrollable-pager' )){
    if ($settings['view_name'] == 'news_items' && $settings['view_display_id'] == 'block_1') {
      if (!empty($vars['ddblock_content'])) {
        foreach ($vars['ddblock_content'] as $key1 => $result) {
          // add pager_item_image variable
          $pager_items[$key1]['image'] = ddblock_add_image(
            $vars,
            // determines which imagcache preset to use, leave to 'pager_item_image'
            'pager_item_image',
            // name of CCK generated image field, change if needed.
            $result->node_data_field_pager_item_text_field_image_fid,
            // alt attribute of image or NULL
            $result->node_data_field_pager_item_text_field_pager_item_text_value,
            // cck content type for default image or NULL, change if needed
            NULL, //'ddblock_news_item',
            // cck fieldname for default image or NULL, change if needed
            NULL, //'field_image',
            // to link the image to or NULL, change if needed
            NULL //'node/' . $result->nid
          );
          // 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['ddblock_pager_items'] = $pager_items;
  }    
}

The page I placed the instance in is xxxx, although there's nothing to be seen there at all.

edk86’s picture

as far as the drupal_set_message lines, how do I find those?

edk86’s picture

I am getting this error: "warning: Invalid argument supplied for foreach() in /home/missour2/public_html/xxxx/sites/all/themes/my theme 2/custom/modules/ddblock/ddblock-cycle-block-content-upright10.tpl.php on line 47."

line 47 is " foreach ($slider_items as $slider_item): "

Could this be my problem? What can I do to fix this?

ppblaauw’s picture

You are using the preprocess functions and maybe also the template files of the new development version of the ddblock module. They are not compatible with version RC6 of the ddblock module.

You can download the files for the RC6 version of the module at http://ddbock.myalbums.biz/download

The drupal_set_message lines can be found in the preprocess function for RC6

edk86’s picture

thanks, ppblaauw. I uploaded the correct preprocess functions and template files. unfortunately that didn't fix it. I still don't see anything.

Here's my template.php:

<?php
// $Id: template.php,v 1.5 2009/01/29 14:32:52 troy Exp $

function phptemplate_preprocess_page(&$vars) {
  $defaults = array(
    'admin_left_column' => 1,
    'admin_right_column' => 0
  );
  
  global $theme_key;
  // Get default theme settings.
  $settings = theme_get_settings($theme_key);    
  $settings = array_merge($defaults, $settings);
 
 
  
  if (arg(0) == 'admin' && ($settings['admin_right_column'] == 0) && !(arg(1) == 'build' && arg(2) == 'block')) {
    $vars['right'] = '';
  }
  
  if (arg(0) == 'admin' && ($settings['admin_left_column'] == 0) && !(arg(1) == 'build' && arg(2) == 'block')) {
    $vars['left'] = '';
  }
  
  $vars['registration_enabled'] = variable_get('user_register', 1);
  $vars['closure'] .= '<span class="developer">
<strong><a href="" title=""></a></strong>          <span class="version"></span>
</span>';
}

function phptemplate_pager_last($text, $limit, $element = 0, $parameters = array()) {
  global $pager_page_array, $pager_total;
  $output = '';
$view_path = "frontpage";  // Change to reflect yours views actual path
if ( arg(0) != $view_path ) {
  // If we are anywhere but the last page
  if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
    $output = theme('pager_link', $text, pager_load_array($pager_total[$element] - 1, $element, $pager_page_array), $element, $parameters, array('class' => 'pager-last'));
  }

  return $output;
  }
}


/**
 * Generate the HTML representing a given menu item ID.
 *
 * An implementation of theme_menu_item_link()
 *
 * @param $link
 *   array The menu item to render.
 * @return
 *   string The rendered menu item.
 */
function phptemplate_menu_item_link($link) {
  if (empty($link['options'])) {
    $link['options'] = array();
  }

  // If an item is a LOCAL TASK, render it as a tab
  if ($link['type'] & MENU_IS_LOCAL_TASK) {
    $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>';
    $link['options']['html'] = TRUE;
  }

  if (empty($link['type'])) {
    $true = TRUE;
  }

  return l($link['title'], $link['href'], $link['options']);
}

/**
 * Duplicate of theme_menu_local_tasks() but adds clear-block to tabs.
 */
function phptemplate_menu_local_tasks() {
  $output = '';

  if ($primary = menu_primary_local_tasks()) {
    $output .= '<ul class="tabs primary clear-block">' . $primary . '</ul>';
  }
  if ($secondary = menu_secondary_local_tasks()) {
    $output .= '<ul class="tabs secondary clear-block">' . $secondary . '</ul>';
  }

  return $output;
}

/*!
 * Dynamic display block preprocess functions
 * Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
 * Version 1.4 (01-SEP-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 mytheme_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,
                    $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 mytheme_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_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'] =  $result->node_data_field_pager_item_text_field_pager_item_text_value;
          }
        }
      }
      $vars['pager_items'] = $pager_items;
    }
  }    
}
ppblaauw’s picture

The template.php file looks ok now.

I had a look at your site and don't see the block or any ddblock functionality.

I see you have Javascript and CSS aggregation enabled at your Internet Site.
This should only be enabled when your site is in Production, not when you are developing.

Clearing your cache also helps in a lot of cases while developing.

Hope this helps you further, please let me know.

edk86’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new457.17 KB

"I see you have Javascript and CSS aggregation enabled at your Internet Site.
This should only be enabled when your site is in Production, not when you are developing."

Sorry, but what does this mean I should do?

I cleared the cache and it didn't help.

Also when I check my Javascript console I get these errors (attached screenshot). I also cannot add content to Panels, which I think has to do with javascript crashing? Could this be related?

edk86’s picture

Status: Postponed (maintainer needs more info) » Active

Now I have a blank space, where the slider should go, but no slider. This is the error I'm getting "warning: Invalid argument supplied for foreach() in /home/missour2/public_html/xxxx/sites/all/themes/my theme 2/custom/modules/ddblock/ddblock-cycle-block-content-upright10.tpl.php on line 47."

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

You can disable Javascript and CSS aggregation at Administer > Site configuration > performance

In the fieldset Bandwidth optimizations: both disable Optimize CSS files and Optimize JavaScript files.
In the documentation in the fieldset you can find also more info why.

This is also the page to clear your cache, with the button: Clear Cached Data

The error about the feedprocessor I also get them in my firefox
The other 2, I dont know where they come from.

I also looked at your Internet site again but don't see any changes.

Further it is better to use underscores in your theme name instead of spaces.
Change this in the folder name, the info file name and in the info file itself.

Do you use a local installation to test things?
Is that why I don't see changes on the Internet Site?

Hope this helps you further, please let me know.

edk86’s picture

Status: Active » Closed (fixed)

#12 worked! Thank you so much!