An advanced Dynamic display block slideshow uses two preprocess functions to convert view fields into template variables. One for the whole slideshow template and one for the pager template.
Note: Only a custom pager needs a preprocess function for the pager template.
The preprocess functions have to be placed in the template.php file of your theme.
Download and install preprocess functions
Important:
Make changes to the preprocess functions
Note: You can see the view_name and the available view fields by uncommenting the drupal_set_message or dsm debug lines at the top of each preprocess function.
In the example preprocess function the following variables are now available in the slideshow template for each slide.
and the following for each custom-pager-item
Changing view_name and or view_field names
If you use a different view_name and/or view fields than in the advanced slideshow tutorial you have to change them in the preprocess functions.
Uncomment the drupal_set_message lines at the top of the two preprocess function.
[theme_name]_preprocess_ddblock_cycle_block_content and [theme_name]_preprocess_ddblock_cycle_pager_content.
You will now see the result of the drupal_set_message lines, which shows the view_name and the view_fields of your view. You can use this for changing the view_name and the view_field names in the preprocess functions in the template.php file.
Changing view_name
In the line:
if ($vars['settings']['view_name'] == 'news_items') {
if ($vars['settings']['view_name'] == '[VIEW_NAME]') {
Changing view_field_names
In the lines like:
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; }
if (isset($result->[VIEW_FIELD_NAME])) { $slider_items[$key1]['slide_text'] = $result->[VIEW_FIELD_NAME]; }
Note:
After you have changed the view_name and field_names comment the drupal set_message line again.
FAQ
Several users have an issue with the preprocess functions. In the trouble shooting part of the FAQ you can find the solutions. The FAQ question are:
Preprocess snippets
Several preprocess snippets can be found in the preprocess snippets section, like how to link the slide image to a page, etc.
Comments
Unable to paste without error
Hello,
I get various errors when pasting the pre-process code. I've renamed the theme_name to the theme that is currently being used for the site.
I am pasting the pre-process code right at the bottom and it comes up with"Parse error: syntax error, unexpected '[', expecting T_STRING in C:\Inetpub\drupal-6.17\themes\customtheme\template.php on line 126
Can someone assist as soon as please?
Please ignore my comment, the
Please ignore my comment, the brackets [ and ] should be removed when renaming (as per post below!)
Can't add my own field
I am trying to display different fields than in the example, but the field I want to use is not showing up when I uncomment the drupal_set_message lines. Specifically, my content type has a CCK Link field that allows multiple values (i.e., each node can have multiple links). My view includes this field and shows the links in the preview.
I was also wondering why all the field names contain "field_pager_item_text": why is it "node_data_field_pager_item_text_field_slide_text_value" and not "node_data_field_slide_text_value"?
Thanks for your help and this nice module
Re: Can't add my own field
For multiple value field you need to disable group fields so for each value a row is made for the slideshow.
Hope this helps you further.
If not please make an issue in the issue queue.
I agree with this very good
I agree with this very good comment.
Jeu gratuit
How to link slide_title to
How to link slide_title to the node? Is it possible to make in the template.php in line
$slider_items[$key1]['slide_title'] = check_plain($result->node_title) ; ??
Re: How to link slide_title to node
You can use:
Hope this helps you further, please let me know.
Great module. Doc. suggestion.
Hi, you might want to specify that you have to rename the entire "[THEME_NAME]", including the brackets. So that people don't try this: "[some_theme_name]_preprocess_ddblock_cycle_block_content", when it should be this: "some_theme_name_preprocess_ddblock_cycle_block_content".
Otherwise this is great documentation for a great module.
Re: Great module. Doc. suggestion.
Thanks for the suggestion. Done. We always try to improve the documentation. More suggestions welcome.
Theme other then Garlad?
Thank you for the awesome module.
My ddblock node displays fine in garland theme, but not in a new them I installed. I updated template.php and appended the theme name. The debug info shows fine, but not the ddblock.
Any thoughts?
Thanks!
RE: Theme other then Garland?
Ahh!
I forgot to upload the ddblock custom theme folder to the new theme.
Also, remeber to run update.php when you modify your theme files.