Well, somehow I keep losing the images in the ddblock module. I love the functionality and how it works. I do not like having my variable names rewritten for me. This time I'm going to take notes.
-
When does it happen?
Basically, when I add a module, it seem to rewrite varaible names. I'm not sure why. The last time it happened I was able to uncomment the error checking lines in the template.php file, it printed out what the array was. I could find the variable name. I could see the values for the image.
-
What is different this time?
Well, the image variable is not there at all. This was my error, I had un-commented the wrong lines.
-
Uncomment the set messages in the template.php file
There are two functions in the template file. The important one is the top function,function [THEME_NAME]_preprocess_ddblock_cycle_block_content. For some weird reason, kept working with a different function. To much on my plate, I was not paying close enough attention. 99% of the time it's the simple things that take so much time....
drupal_set_message('<pre>' . var_export($vars['settings']['view_name'], true) . '</pre>');
drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');'news_items'
These two lines of code printed this information out to the screen:
stdClass::__set_state(array(
'nid' => '4',
'node_title' => 'Montana At Her Best',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'Nature',
'node_type' => 'ddblock_news_item',
'node_vid' => '4',
'node_data_field_pager_item_text_field_slide_text_value' => '
Drive through a buffalo herd, watch a grand elk wade it's way through a river, hike to a mountain top and watch the sun dance on distant peaks. Come and Explore Arlee!
',
'node_data_field_image_field_image_fid' => '23',
'node_data_field_image_field_image_list' => '1',
'node_data_field_image_field_image_data' => 'a:2:{s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => '',
'node_revisions_format' => '2',
I have put the line in bold that is the variable for the image.
-
The next step is to adjust the preprocessor functions in the template.php file.
I changed this line:
node_data_field_pager_item_text_field_image_fid to this line:
node_data_field_image_field_image_fid.
I now have images again - until I push another button. This makes me uneasy, but the functionality is pretty kewl....so I'll play the game. Now that I have the notes I need the next time the error shows up, I'm a tad more relaxed.
Good tutorial at:
http://ddblock.myalbums.biz/faq#19n881