I love the module as far as it's capabilities but I haven't been able to get it to work at all for inserting it into nodes or blocks for that matter. I need it to insert into nodes for a news site i'm working on using user picture uploads.
I followed your tutorial at ddblock for nodes and will tell you what i've done as follows. I should have all the modules installed i need as mentioned on the homepage.
My theme is: deco but will be a zen subtheme when i get it working
1) I already have a content type called articles that I wanted this to use.
So I added the imagefield as stated with 4 image slots and followed all the instructions.
2) I created a node_gallery block view like mentioned and followed the instructions, I also left the style unformatted as it didn't mention anything in the tutorial about that. For node type I set it equal to article as that is the node i want to reference. I don't think i made any mistakes in steps 1 and 2.
3)I went to dynamic display block went to settings, clicked on the articles node and views - node_gallery: Block and then saved.
4)Set an instance and named it "Image Node Gallery" views node_gallery: Block
5)I configured my block, all i did was turn on cycleblock, turned on the upright40 template , and turned on visibility setting for all the user types and left the default settings.Saved. I also added a premade theme file from one of the other 40type themes in the deco subfolder in case the upright40 didn't work.
6) From here I didn't want to fiddle with the php code yet, I just wanted to move the block into the sidebar and see if it was working. When I did and visited the premade article content with pictures, nothing displayed at all besides the blocktitle:
Image Node Gallery. I also added my views block, so I know the views block was working as it displayed a bunch of pictures.
7) So I then tried the php code
"$block = module_invoke('ddblock', 'block', 'view','8');
print $block['content']; " above the content area in node-article.tpl.php after copying and renaming node.tpl.php and after I checked my block number was 8. Nothing at all happened, it was exactly the same. I cleared the cache and tried again, still nothing.
8) So then I decided to add the preprocess functions:
function deco_preprocess_ddblock_cycle_block_content
if ($vars['settings']['view_name'] == 'node_gallery') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add slide_image variable
if (isset($result->node_data_field_multiple_image_field_field_multiple_image_field_fid)) {
// get image id
$fid = $result->node_data_field_multiple_image_field_field_multiple_image_field_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,
$result->node_title);
}
else {
$slider_items[$key1]['slide_image'] =
''" alt="' . $result->node_title .
'"/>';
}
}
// add slide_title and slide_text variable from imagefield title and description
if (isset($result->node_data_field_multiple_image_field_field_multiple_image_field_data)) {
$data=unserialize($result->node_data_field_multiple_image_field_field_multiple_image_field_data);
if (isset($data['description'])) {
$slider_items[$key1]['slide_text'] = $data['description'];
}
if (isset($data['title'])) {
$slider_items[$key1]['slide_title'] = $data['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;
}
}function deco_preprocess_ddblock_cycle_pager_content
if ($vars['pager_settings']['view_name'] == 'node_gallery') {
if (!empty($vars['content'])) {
foreach ($vars['content'] as $key1 => $result) {
// add pager_item_image variable
if (isset($result->node_data_field_multiple_image_field_field_multiple_image_field_fid)) {
$fid = $result->node_data_field_multiple_image_field_field_multiple_image_field_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,
$result->node_data_field_multiple_image_field_field_multiple_image_field_data);
}
else {
$pager_items[$key1]['image'] =
''" alt="' . $result->node_data_field_multiple_image_field_field_multiple_image_field_data .
'"/>';
}
}
// add pager_item _text variable from imagefield alternative text
if (isset($result->node_data_field_multiple_image_field_field_multiple_image_field_data)) {
$data=unserialize($result->node_data_field_multiple_image_field_field_multiple_image_field_data);
if (isset($data['alt'])) {
$pager_items[$key1]['text'] = $data['alt'];
}
}
}
}
$vars['pager_items'] = $pager_items;
}
I add that inside my deco default template.php file. , then when i refresh the page I get an error.
"Parse error: parse error, expecting `'('' in C:\wamp\www\drupal\sites\all\themes\deco\template.php on line 256"
256 is right at : " if ($vars['settings']['view_name'] == 'node_gallery') { "
9) as you can see I got no idea what is going on, any help is appreciated, i'm only 2 months into drupal, so please be detailed in possible solutions, thanks a ton.
Comments
Comment #1
ppblaauw commentedCan you attach your complete template.php file, so I can help you better.
Comment #2
WI.Ventures commentedI dropped it for a stylized thumbnail views slideshow. I will continue to play around with ddblock but you can mark this as closed unless I want to try again. Thanks none-the-less.
Will
Comment #3
ppblaauw commentedclosed