Only title text and read more link in DDblock

larry_za - October 20, 2009 - 09:59
Project:Dynamic display block
Version:6.x-1.0-rc6
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hi
A serious newbie here, both to Drupal and DDblock. I followed the instructions, with my own content though, and the block is showing, but only the title text and the read more button. ie The image is not showing and neither the second content field. I have created 2 nodes. There are three fields in the View named - "Most recent".

Below is the debug info, yes that is all:

*

array (
'delta' => '4',
'output_type' => 'view_fields',
'pager' => 'custom-pager',
'pager_container' => NULL,
'pager_event' => NULL,
'pager_height' => 63,
'pager_width' => 195,
'imgcache_pager_item' => 'image_new_vehicle_carousel',
'pager_position' => 'bottom',
'template' => 'upright50',
'custom_template' => NULL,
'view_name' => 'most_recent',
)

*

stdClass::__set_state(array(
'nid' => '3',
'node_type' => 'vehicle_input',
'node_vid' => '3',
'node_title' => 'A 160 Avantgarde , MERCEDES BENZ',
'node_created' => '1255006494',
))

*

'most_recent'

*

stdClass::__set_state(array(
'nid' => '3',
'node_type' => 'vehicle_input',
'node_vid' => '3',
'node_title' => 'A 160 Avantgarde , MERCEDES BENZ',
'node_created' => '1255006494',
))

Here is my template.php

function cti_flex_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('' . var_export($vars['settings']['view_name'], true) . '');
drupal_set_message('' . var_export($vars['content'][0], true) . '');
if ($vars['settings']['view_name'] == 'most_recent') {
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'] <> ''){
$slider_items[$key1]['slide_image'] =
theme('imagecache',
$vars['imgcache_slide'],
$filepath,
check_plain($result->node_title));
}
else {
$slider_items[$key1]['slide_image'] =
'node_title) .
'"/>';
}
}
// 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'] = l('Read more...', 'node/' . $result->nid);
$slider_items[$key1]['slide_node'] = base_path() . '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 cti_flex_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('' . var_export($vars['pager_settings'], true) . '');
drupal_set_message('' . var_export($vars['content'][0], true) . '');
if ($vars['pager_settings']['view_name'] == 'most_recent') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add pager_item_image variable
if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
$fid = $result->node_data_field_pager_item_text_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'] <> ''){
$pager_items[$key1]['image'] =
theme('imagecache',
$vars['pager_settings']['imgcache_pager_item'],
$filepath,
check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value));
}
else {
$pager_items[$key1]['image'] =
'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'] = check_plain($result->node_data_field_pager_item_text_field_pager_item_text_value);
}
}
}
}
$vars['pager_items'] = $pager_items;
}
}

BLOCK SETTINGS

Template: Upright50
Use pager to select slides is ticked

I am using cti_flex theme and the view itself is fine. I made a clone of the view and placed it in a different region and it shows without a problem.

It is still a production site on localhost so I can't give you a link.

I hope this is enough info.

By the way great module.

Larry

#1

larry_za - October 20, 2009 - 12:22
Status:active» fixed

Hi

Fixed. Maybe I should read the instructions to the letter. Image now showing. (Hahaha) I am now working on getting it to display/look the way I want it to. My image field settings in CCK were wrong, hence no _fid in the debug.

Larry

#2

scsmith - November 3, 2009 - 00:03

I had it working, and then it quit working (gray box, no image), I'm not getting _fid in the debug....curious what you might have changed to cure it. I'll re-read the instructions, but since it was working and stopped, my guess is it quit working when I upgraded imagefield recently?

#3

iren - November 3, 2009 - 02:20
Status:fixed» postponed (maintainer needs more info)

#2

Did you enable the Content Permissions module (CCK - submodule)?

Did you give permission for the field you use in your slideshow block?

Did you run update.php after upgrading modules?

Did you clear the cache at Admin > Site configuration >Performance?

Can you send the result of the drupal_set_message debug lines when you uncomment them in the preprocess functions?

Can you send the content of the template.php file?

Can you send a link to the site?

Please provide this information so I can help you better.

Hope this helps you further, please let me know.

#4

sylus - November 3, 2009 - 02:48

I am having this exact same problem, no image is showing up but everything else is working properly. The images stop working after i updated imagecache and imagefield etc....

#5

scsmith - November 20, 2009 - 15:38

I had this problem a couple of times (working/not working/working/not working) and finally figured out what I did "wrong". The "clue" I had was that every time it quit working, I also lost the "_fid" in the debug.

I installed DDBLOCK (a GREAT module, by the way) and used the install files to create the slideshow. It created the content type (ddblock_news_item) for me, and used the generic field name "field_image" for the image. This isn't really a problem, EXCEPT that I had already used that name in another content type. SO, when I made a change to the other content type (ie changed from required to not required), it changed the "ddblock_news_item" content type as well.

My solution....deleted "field_image", created new field as "field_news_image". Then updated the View to get the new image, then updated my template.php to understand the new field (in my case, node_data_field_pager_item_text_field_news_image_fid)

My suggestion would be to change the example to have the image field be called something more unique than "field_image" to prevent others from having the same problem. For me it did become somewhat of an "issue" because while troubleshooting I changed the "Number of values:" from "unlimited" to one, and ended up losing the images in my other content type, which I'm now having to re-upload.

Anyway, thanks for the great module...hope this helps someone else!

#6

ppblaauw - November 21, 2009 - 09:09

#4

Have a look at the fieldname of the imagefield (field looks like ...._fid) by uncommenting the drupal_set_message lines in the preprocess function or in the preview sql_statement of the view.

Compare the fieldname with the name in the preprocess functions and change if needed.

#5

Yes that is the way CCK works.
Changing the first cck field (order of fields), will create other fieldnames.
Reusing a field, will make another database structure, with other fieldnames.
Changing a single value field to a mutiple value field will also make another database structure, with other field names.
Etc.
In the CCK documentation on Drupal.org further explanations can be found on how and why the database structure is changed and how fieldnames are generated by CCK.

Yes, good suggestion to make more unique names, to minimize that users by mistake reuse the field, but I doubt if that will help solving this issue. Still users will reuse fields till they understand how CCK works.

You can reuse a field or make from a single value field a multiple value field if you know that you also need to change the fieldname is the preprocess function for the ddblock module.

I don't have an easy solution for this. but hopefully with yours and my explanation this will help future users with this issue

#7

NelsonEC - November 22, 2009 - 21:28

Hello,

I've also got the grey-box-problem. After reading a lot about it I think, unchecking that "group multiple values"-checkbox will solve it. But maybe I am stupid, but I did not find that option anywhere. Can you tell me where it is?

#8

iren - November 23, 2009 - 01:30

#7

To unchecked the "Group multiple values", go to Administer > Site building > Views.

You have to configure the field name you use for the images, then you would be able to see the "Group multiple values" checkbox option.

Or you can have a look at this Views field tutorial page to give you more information how to configure the fields you use for the view.

Hope this helps you further, please let me know.

#9

NelsonEC - November 23, 2009 - 03:23

no, there is no such checkbox. My settings page looks quite different to the one you linked. Nevertheless, I found out something more:

I saw that I don't have the problem with images, but with embedded videos. Even if I try to have Pictures and Videos in the same ddblock (what my final goal is), the images show up, the videos don't.

the preprocess-part of my template.php is not edited.

Thank you for your help.

#10

ppblaauw - November 23, 2009 - 06:25

#9

You can have a look at the: Advanced slideshow using embedded video tutorial

Hope this helps you further, please let me know.
If not please make another issue, so they keep useful for other users, searching on past issues.

#11

NelsonEC - November 23, 2009 - 20:10

Thank you, but I already read this tutorial. That doesn't help me further. Videos simply do not show up. I create a new issue.

#12

iren - November 24, 2009 - 00:52

#4 sylus
Did you fix your issue?

 
 

Drupal is a registered trademark of Dries Buytaert.