I am having problems getting a dynamic display block to display. Nothing appears in the place where it should and I think it comes from the content type "News item."

I used the Advanced slideshow tutorial. The error message that displays is:

node_data_field_image_field_image_data (String, 68 characters ) a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:""...

I removed the image description field from the content type, but the message keeps popping up like it did not get removed completely. I tried removing all content and flushing all caches, then re-creating content, but they apparently still have the field.

Here is the content of my template.php file (sites/all/themes/garland):

<?php
// $Id: template.php,v 1.16.2.1 2009/02/25 11:47:37 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>';
  }
}

/**
 * Allow themable wrapping of all comments.
 */
function phptemplate_comment_wrapper($content, $node) {
  if (!$content || $node->type == 'forum') {
    return '<div id="comments">'. $content .'</div>';
  }
  else {
    return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</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);
  }
}

/**
 * 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.3 (18-MAR-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_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;
    }
  }    
}
CommentFileSizeAuthor
#8 template.php.txt8.28 KBmichaelbstringer

Comments

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

Can you uncomment the drupal_set_message lines in both preprocess functions instead of the dsm debug lines and send the result?

Can you also send a link to your site or a screenshot of the error you see?

Please provide this information, so I can help you better.

michaelbstringer’s picture

Hi and thanks, ppblaauw.

Here is the error message:

* ImageMagick command: /usr/bin/convert -resize 100x75! 'sites/default/files/images/Bennett_1.jpg' 'sites/default/files/imagefield_thumbs/images/Bennett_1.jpg'
* ImageMagick output:
* News item test 1 has been created.
*

'news_items'

*

stdClass::__set_state(array(
'nid' => '216',
'node_title' => 'test 1',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'test this pager',
'node_type' => 'ddblock_news_item',
'node_vid' => '216',
'node_data_field_pager_item_text_field_slide_text_value' => 'slide on over',
'node_data_field_image_field_image_fid' => '29',
'node_data_field_image_field_image_list' => '1',
'node_data_field_image_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => '

test text
',
'node_revisions_format' => '1',
'node_created' => '1242412066',
))

My drupal test site is located at: http://landconserve.org/drupal/

Thanks again, Michael

ppblaauw’s picture

Thanks for sending the information

The message has something to do with imagecache trying to convert the image with the ImageMagick package. ( I don't see the message, You see it when you create the node? Maybe just information that the image is converted.)

I also don't see the earlier error message:

node_data_field_image_field_image_data (String, 68 characters ) a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:""...

The template.php file looks ok.

Did you create at least 2 nodes?
The custom folder from the ddblock themes download is placed in sites/all/themes/garland?
You don't have a garland theme anymore in the drupal root themes directory?

Can you also clear the cache at administer > site configuration > performance.

Please let me know the results.

michaelbstringer’s picture

You don't have a garland theme anymore in the drupal root themes directory?

I tried this, and then my update.php page came up blank! According to http://drupal.org/node/112884, I should leave the default garland files alone. Now, after restoring the files, I still get a blank update.php screen...not sure how to fix this one...

ppblaauw’s picture

Your garland theme is the theme you use for your site. I think you moved the garland theme to sites/all/themes.

The right way to make your own custom theme from the garland theme is to make a copy of the garland theme from drupal_root/themes to sites/all/themes.

You can not have two themes with the same name so you need to rename your custom theme to e.g.
mygarland, so you get

sites/all/themes/mygarland.

You also need to rename the garland.info file to mygarland.info in this directory and edit this file to set the theme_name to Mygarland. (this will show up in the theme page)

Example:

; $Id: mygarland.info,v 1.5 2007/07/01 23:27:32 goba Exp $
name = MyGarland
description = Tableless, recolorable, multi-column, fluid width theme (default).
version = VERSION
core = 6.x
engine = phptemplate

Now your issue.
I think it's best to restore the garland theme first at sites/all/themes.
So your site will show up again. (the theme registry is looking at this place).
After that you switch to another default drupal theme.
You change the garland theme in sites/all/themes to mygarland (like explained above).
Then restore the garland theme in drupal_root/themes.

Hope you can follow my explanation, to get your site back.

I just asked the question about the garland theme, because when you would upgrade drupal and drupal places a new garland theme in your drupal_root/themes folder your site would not work anymore (two themes with the same name)

After you get your site back we can hopefully get the ddblock module also working.

michaelbstringer’s picture

Thanks, ppblaauw. I know what you're thinking, "What is this? Amateur night? Who let this guy in here?" ; )

I got the site back, created the MyGarland theme and switched over to the theme and made adjustments to the template.php to reflect the change in theme name.

Here is the set state array message:

#

array (
  'delta' => '1',
  'output_type' => 'view_fields',
  'pager' => 'custom-pager',
  'pager_container' => NULL,
  'pager_event' => NULL,
  'pager_height' => 63,
  'pager_width' => 400,
  'imgcache_pager_item' => 'Medium',
  'pager_position' => 'top',
  'template' => 'upright40',
  'custom_template' => NULL,
  'view_name' => 'news_items',
)

#

stdClass::__set_state(array(
   'nid' => '218',
   'node_title' => 'Test 2',
   'node_data_field_pager_item_text_field_pager_item_text_value' => 'test this pager2',
   'node_type' => 'ddblock_news_item',
   'node_vid' => '218',
   'node_data_field_pager_item_text_field_slide_text_value' => 'slide with test 2',
   'node_data_field_image_field_image_fid' => '34',
   'node_data_field_image_field_image_list' => '1',
   'node_data_field_image_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
   'node_revisions_body' => '

Can you believe this place?
',
   'node_revisions_format' => '1',
   'node_created' => '1242771164',
))

#

'news_items'

#

stdClass::__set_state(array(
   'nid' => '218',
   'node_title' => 'Test 2',
   'node_data_field_pager_item_text_field_pager_item_text_value' => 'test this pager2',
   'node_type' => 'ddblock_news_item',
   'node_vid' => '218',
   'node_data_field_pager_item_text_field_slide_text_value' => 'slide with test 2',
   'node_data_field_image_field_image_fid' => '34',
   'node_data_field_image_field_image_list' => '1',
   'node_data_field_image_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
   'node_revisions_body' => '

Can you believe this place?
',
   'node_revisions_format' => '1',
   'node_created' => '1242771164',
))

Thanks again for helping out!

ppblaauw’s picture

I can understand the issues you got, we all get them in the beginning. Don't think I just know how things work. I also learned it the hard way. Glad to help.

I don't see the CSS file of the upright40 theme used at your site.
Did you place the custom folder from the free themes download at ddblock.myalbums.biz in the folder like below?

sites/all/themes/mygarland/custom

Can you not use image cache settings for now, to get the slideshow working first.
After the slideshow works you can enable image cache presets again.
Can you also send the template.php file how it is now as an attachment.

Hope this will help to solve the issue

michaelbstringer’s picture

StatusFileSize
new8.28 KB

I also do not see the upright40 css file (?)

When I check the "use advanced settings", that causes the block to send up a bunch of error messages.

I left it unchecked and the image at least appears on the site:

http://landconserve.org/drupal/

I placed the files so that the structure to the css file looks like this:

sites/all/themes/mygarland/custom/modules/ddblock/upright40/ddblock-cycle-upright40.css

Thanks again for the help, Phillip!

ppblaauw’s picture

Can you set the use advanced settings again, so I can see what is wrong.

michaelbstringer’s picture

done.

ppblaauw’s picture

In the configuration page of the block can you set the template to upright40 instead of custom.

michaelbstringer’s picture

It is already set to upright40...

ppblaauw’s picture

Still it can not find the ddblock-cycle-block-content-upright40.tpl.php file and the therefore also not the ddblock-cycle-upright40.css file.

Maybe there is a problem with permission on your server. Maybe the dblock-cycle-block-content-upright40.tpl.php doesn't have read access.

Can you delete your whole custom folder at:

sites/all/themes/mygarland/custom

download the theme files again from the ddblock.myalbums.biz site with the custom folder
and place it again in:

sites/all/themes/mygarland

And check if all the files have read access.

michaelbstringer’s picture

OK, I am making headway. I'm not sure what I did, but I noticed a folder in the mygarland directory called "Modules", whic contained the same stuff w/in the mygarland/custom/modules folder (i.e. ddblock/uprigh40/file.css).

I deleted all and replaced with a fresh version from the ddblock.myalbums.biz site, but only the modules/...

It works!

I'm not sure what I did to make the module refer to that folder instead of the custom/ folder...but thanks for working through the issue with me.

I also needed to make a different image field with a different name, as I believe it was interfering somehow (I changed a few things, so this may be incorrect).

What really helped was re-watching the last part of the advanced slideshow tutorial where it talks about changing the variable names.

Thanks!

ppblaauw’s picture

Title: Dynamic Display Module does not display » Dynamic Display Module does not display, how should the theme directory structure be?
Status: Postponed (maintainer needs more info) » Fixed
Issue tags: +Advanced slideshow, +directory structure

Great you got the module working with help of the video tutorial.

To explain the directory structure:

I does not matter in which directory the ddblock themes are installed within the directory of the theme you use. The Drupal theme system will find the ddblock themes. But, you can not have the same files in different directories.

We use a custom folder in the theme to place all customizations, so the theme is easy to upgrade. For module theme customizations we place them per module in the modules directory under the custom directory. If you don't use the custom directory it's also ok.

Changed issue title to make it more useful to search on.
Set status to fixed.
Add tags.

Status: Fixed » Closed (fixed)
Issue tags: -Advanced slideshow, -directory structure

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