Closed (fixed)
Project:
Dynamic display block
Version:
6.x-1.0-rc6
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Jun 2009 at 15:47 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
trapdoordesigns commentedi think i'm having the same problem. where the news items appear in a list going down rather than being displayed as a slideshow right?
Comment #2
ppblaauw commentedI hope you use version 6.x-1.0-rc6.
To help you better I need some more information:
Can you uncomment the drupal_set_message lines in the ddblock preprocess functions in your template.php file.
You should see debug lines now in the page where you placed the dynamic display block. Can you attach this result?
Can you attach your template.php file?
Can you send a link to the Internet Site?
Please provide this information, so I can help you better.
Comment #3
trapdoordesigns commentedwell i havnt seen the owner of the post reply so here i go, i have here my template.php and an image of how it is coming out attached.
<?php
// $Id: template.php,v 1.17.2.1 2009/02/13 06:47:44 johnalbin Exp $
/**
* @file
* Contains theme override functions and preprocess functions for the theme.
*
* ABOUT THE TEMPLATE.PHP FILE
*
* The template.php file is one of the most useful files when creating or
* modifying Drupal themes. You can add new regions for block content, modify
* or override Drupal's theme functions, intercept or make additional
* variables available to your theme, and create custom PHP logic. For more
* information, please visit the Theme Developer's Guide on Drupal.org:
* http://drupal.org/theme-guide
*
* OVERRIDING THEME FUNCTIONS
*
* The Drupal theme system uses special theme functions to generate HTML
* output automatically. Often we wish to customize this HTML output. To do
* this, we have to override the theme function. You have to first find the
* theme function that generates the output, and then "catch" it and modify it
* here. The easiest way to do it is to copy the original function in its
* entirety and paste it here, changing the prefix from theme_ to lava_theme_.
* For example:
*
* original: theme_breadcrumb()
* theme override: lava_theme_breadcrumb()
*
* where lava_theme is the name of your sub-theme. For example, the
* zen_classic theme would define a zen_classic_breadcrumb() function.
*
* If you would like to override any of the theme functions used in Zen core,
* you should first look at how Zen core implements those functions:
* theme_breadcrumbs() in zen/template.php
* theme_menu_item_link() in zen/template.php
* theme_menu_local_tasks() in zen/template.php
*
* For more information, please visit the Theme Developer's Guide on
* Drupal.org: http://drupal.org/node/173880
*
* CREATE OR MODIFY VARIABLES FOR YOUR THEME
*
* Each tpl.php template file has several variables which hold various pieces
* of content. You can modify those variables (or add new ones) before they
* are used in the template files by using preprocess functions.
*
* This makes THEME_preprocess_HOOK() functions the most powerful functions
* available to themers.
*
* It works by having one preprocess function for each template file or its
* derivatives (called template suggestions). For example:
* THEME_preprocess_page alters the variables for page.tpl.php
* THEME_preprocess_node alters the variables for node.tpl.php or
* for node-forum.tpl.php
* THEME_preprocess_comment alters the variables for comment.tpl.php
* THEME_preprocess_block alters the variables for block.tpl.php
*
* For more information on preprocess functions and template suggestions,
* please visit the Theme Developer's Guide on Drupal.org:
* http://drupal.org/node/223440
* and http://drupal.org/node/190815#template-suggestions
*/
/*
* Add any conditional stylesheets you will need for this sub-theme.
*
* To add stylesheets that ALWAYS need to be included, you should add them to
* your .info file instead. Only use this section if you are including
* stylesheets based on certain conditions.
*/
/* -- Delete this line if you want to use and modify this code
// Example: optionally add a fixed width CSS file.
if (theme_get_setting('lava_theme_fixed')) {
drupal_add_css(path_to_theme() . '/layout-fixed.css', 'theme', 'all');
}
// */
/**
* Implementation of HOOK_theme().
*/
function lava_theme_theme(&$existing, $type, $theme, $path) {
$hooks = zen_theme($existing, $type, $theme, $path);
// Add your theme hooks like this:
/*
$hooks['hook_name_here'] = array( // Details go here );
*/
// @TODO: Needs detailed comments. Patches welcome!
return $hooks;
}
/**
* Override or insert variables into all templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered (name of the .tpl.php file.)
*/
/* -- Delete this line if you want to use this function
function lava_theme_preprocess(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the page templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("page" in this case.)
*/
/* -- Delete this line if you want to use this function
function lava_theme_preprocess_page(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the node templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("node" in this case.)
*/
/* -- Delete this line if you want to use this function
function lava_theme_preprocess_node(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the comment templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("comment" in this case.)
*/
/* -- Delete this line if you want to use this function
function lava_theme_preprocess_comment(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */
/**
* Override or insert variables into the block templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("block" in this case.)
*/
/* -- Delete this line if you want to use this function
function lava_theme_preprocess_block(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
// */
function lava_theme_preprocess_node(&$vars, $hook) {
$vars['adverttop'] = theme('blocks', 'adverttop');
}
// Override theme_button
function phptemplate_button($element) {
// Make sure not to overwrite classes.
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
// We here wrap the output with a couple span tags
return '\n";
}
/*!
* 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 lava_theme_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('
');
drupal_set_message('
');
'" alt="' . $result->node_title .
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'] <> ''){
$slider_items[$key1]['slide_image'] =
theme('imagecache',
$vars['imgcache_slide'],
$filepath,
$result->node_title);
}
else {
$slider_items[$key1]['slide_image'] =
'
'"/>';
}
}
// 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 lava_theme_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('
');
drupal_set_message('
');
'" alt="' . $result->node_data_field_pager_item_text_field_pager_item_text_value .
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'] <> ''){
$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'] =
'
'"/>';
}
}
// 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;
}
}
}
Comment #4
zenessa commentedlol it's only been a few hours, different time zones - i've been sleeping
Ppblaauw thank you for your reply. I have attached a copy of my template.php as requested. Yes I am using the 6.x-1.0-rc6 version (i must have selected the wrong one in the settings)
My site link address is
http://tinyurl.com/o3cjf3
Thank you for any suggestions
Zenessa
Comment #5
zenessa commentedI forgot to add, that after I uncommented those lines I got no debugging messages.
thanks
Comment #6
ppblaauw commented@zenessa
Thanks for sending the template.php file and the link
You had the ddblock preprocess functions inside an if statement.
I placed the ddblock preprocess functions at the bottom of the template.php file and also uncommented the drupal_set_message debug line in the pager preprocess functions
Attached the adjusted file (you need to rename it to template.php)
Hope this helps you further, please let me know.
Comment #7
ppblaauw commented@ trapdoordesigns
Answered your issue at: http://drupal.org/node/481556#comment-1667204
Please use that issue for further posts.
Comment #8
zenessa commentedThanks for your reply. I have uploaded the new code, still with no change. It's quite puzzling.
Comment #9
ppblaauw commentedI think you use the "News item slideshow" block instead of the "ddblock-News item slideshow" in your content.
You need to use the:
if you followed the names in the tutorials.
Hope this helps you further, please let me know.
Comment #10
ppblaauw commentedAlso if you set the configuration setting, display method to: default, in the configuration page, the slideshow will not show.
You need to set the display method to: Cycle
Comment #11
zenessa commentedHi, thanks for the reply.
I think that I am getting closer. I did have the wrong block enabled. I have fixed that and now I just get the shaded blocks and thumbnails.
this error message is popping up now
thanks again
*
array (
'delta' => '5',
'output_type' => 'view_fields',
'pager' => 'custom-pager',
'pager_container' => NULL,
'pager_event' => NULL,
'pager_height' => 63,
'pager_width' => 195,
'imgcache_pager_item' => '',
'pager_position' => 'bottom',
'template' => 'upright40',
'custom_template' => NULL,
'view_name' => 'news_items',
)
*
stdClass::__set_state(array(
'nid' => '2099',
'node_title' => 'news item 1 (sample)',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'pager item 2 (sample)',
'node_type' => 'ddblock_news_item',
'node_vid' => '2099',
'node_data_field_pager_item_text_field_slide_text_value' => 'slide item 1 (sample)',
'node_data_field_pager_item_text_field_image_fid' => '99',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => 'news item 1(sample) ',
'node_revisions_format' => '1',
'node_created' => '1244128092',
))
*
'news_items'
*
stdClass::__set_state(array(
'nid' => '2099',
'node_title' => 'news item 1 (sample)',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'pager item 2 (sample)',
'node_type' => 'ddblock_news_item',
'node_vid' => '2099',
'node_data_field_pager_item_text_field_slide_text_value' => 'slide item 1 (sample)',
'node_data_field_pager_item_text_field_image_fid' => '99',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => 'news item 1(sample) ',
'node_revisions_format' => '1',
'node_created' => '1244128092',
))
Im not sure what that means
Comment #12
ppblaauw commentedYes, you are getting closer.
You need to change several times the image field string in both preprosess functions, which ends on:
into
Hope this helps you further, please let me know.
Comment #13
zenessa commentedThank-you so much for your help. Everything is working perfectly now.
Comment #14
ppblaauw commentedGreat!
Set status to fixed
Added tags