Hi,
when my view has no results, slideshow still generates html code for a empty slideshow. That is destroying my layout because CSS-styles are still rendered on that empty slideshow markup.
The problem is, that the view doenst return a empty result, it returns an result with one row and only nid set:
#
result (Array, 1 element)
*
0 (Object) stdClass
o
nid (String, 1 characters ) 5
o
node_node_data_field_referenzen_type (NULL)
o
node_node_data_field_referenzen_nid (NULL)
o
node_node_data_field_referenzen_vid (NULL)
(Copy&Paste form Krumo ;) )
my dirty bugfix: (add it to template.php)
function template_preprocess_views_slideshow_singleframe(&$vars) {
//Dont show Slideshow when view returns empty result
$empty = true;
foreach($vars['view']->result[0] as $attr => $value){
if($attr != 'nid' && $value != NULL){
$empty = false;
}
}
if($empty){
$vars['slideshow'] = '';
}
}
Can you pls fix that? :)
thx
Comments
Comment #1
mallezieI confirm this for 6.3 beta 1
I commented the first part of the condition, otherwise it would disable a view of content types without body.
Comment #2
snufkin commentedBut that is not an empty slideshow then, if you have an element in it. You probably mean that you have a slideshow where there are no fields to be displayed are not set?
Also I don't think that any issue with 2.x will be fixed now, you should try it with 3.x, that is the actively developed branch.
Comment #3
redndahead commentedThis is fixed in 6.x-2.x, 6.x-3.x and 7.x-3.x
Comment #5
FAAREIA commentedI just downloaded the lastest dev and this is not fixed.
Slideshow
$slideshow variable just render the content, so if we have pager, or controler, slideshow is still shown.
To prevent render of $slideshow i just add a
if ( !empty($rows[0]) ) { print $slideshow; }"to my views-slideshow.tpl.phpPager
Pager is still shown even if $slideshow is not printed. We have 3 .tpl
To prevent the render of the pager i add to my custom views-slideshow-pager-fields.tpl.php
My pager structure ->
ul>li>textMy pager views-slideshow-pager-field-item.tpl.php have:
<li id="views_slideshow_pager_field_item_<?php print $variables['location']; ?>_<?php print $variables['vss_id']; ?>_<?php print $variables['count']; ?>" class="slideshow_<?php print $variables['count']; ?>"><?php print $item; ?></li>My pager "views-slideshow-pager-field-field.tpl.php" has:
<?php print $view->style_plugin->rendered_fields[$count][$field]; ?>Hope it helps someone
Greetings
Comment #6
Gabriel R. commentedI confirm that this is not fixed in the latest release.
My quick and dirty fix is to copy
views-slideshow.tpl.phpfrom the module to my theme and change this:if (!empty($slideshow)):…to this:
if (!empty($rows[0])):Comment #10
nickdickinsonwildeAs far as I can tell this is fixed, if anyone is experiencing this with 7.x-3.2 or higher re-open.