I notice that pager still display if there is only one slide.
I make a dirty fix but that's not a great solution :

  // Render all the fields.
  $vars['rendered_field_items'] = '';
+  if(count($vars['view']->result)>1) {
  foreach ($vars['view']->result as $count => $node) {
    $rendered_fields = '';
    foreach ($vars['settings']['views_slideshow_pager_fields_fields'] as $field => $use) {
      if ($use !== 0 && is_object($vars['view']->field[$field])) {
        $rendered_fields .= theme('views_slideshow_pager_field_field', array('view' => $vars['view'], 'field' => $field, 'count' => $count));
      }
    }
    $vars['rendered_field_items'] .= theme('views_slideshow_pager_field_item', array('vss_id' => $vars['vss_id'], 'item' => $rendered_fields, 'count' => $count));
  }
+  }

It could be better to add an option in the settings.

Comments

Probably better if it was an option. I know some people who would prefer to have the pager.

I cant seem the find the code or similar in version 6.x - 2.x dev. I assume I cant simply apply this my current version. Can anyone suggest how I could achieve the same result with on 6.x - 2.x dev?

Thanks.

I posted a similar request over here 7.x #1126238: Hide pager if only one slide

Marking that one as a duplicate.

Above patch worked great, this is the file you need to change
"\sites\all\modules\views_slideshow\theme\views_slideshow.theme.inc"

Category:bug» feature

StatusFileSize
new3.77 KB

I created this as an option for "Pager fields", called "Hide pager if there is only one slide" with the description "Should the pager be hidden if there is only one slide.". Please review the patch.

I set the default to hide for one slide, because it does not make sense to show the pager if there is only one slide. This will change the default behavior but I think this may be ok, because its currently a developer version.

StatusFileSize
new3.77 KB

FIXED typo in variable.

woot

Status:Active» Needs review

The same result can be achieved by theming the slideshow without patching the module. Copy "views-slideshow-slide-counter.tpl.php" from "views_slideshow/theme/" to your theme folder and wrap the div with the following condition:

<?php if (count($rows) > 1): ?>
<div id="views_slideshow_slide_counter_<?php print $variables['vss_id']; ?>" class="<?php print $classes; ?>">
  <span class="num">1</span> <?php print t('of'); ?> <span class="total"><?php print count($rows); ?></span>
</div>
<?php endif; ?>

Of course, don't forget to rescan the template files afterwards...

Of course you can do this just by theming and at the moment it's a nice workaround. Anyway would like to have this done in the module. Would be great if this gets some more reviews.

StatusFileSize
new3.78 KB

Great work osopolar, this is an important feature in my opinion.

This patch works well, but there is one problem.

It decides whether to display the pager based on the $vars['view']->total_rows variable.
After tearing out my hair for a couple of hours as this patch was not working for me, I discovered that this variable is NULL when there is no pager.

See this comment from merlinofchaos: http://drupal.org/node/347819#comment-1189915

A better solution might be to count the $vars['view']->result.

Here's an updated patch with this change, plus a spelling mistake correction in a comment (pedantic I know! lol.)

Works well for me. Would be great to get this committed.

The condition in #9 also works with the templates in 6.x-2.3. This makes it a lot cleaner, thanks!

Priority:Normal» Critical

Status:Needs review» Reviewed & tested by the community

Patch applies cleanly, works as suggested. Thanks so much.

Status:Reviewed & tested by the community» Fixed
StatusFileSize
new3.79 KB
new3.81 KB

Basically committed the patch with a few changes.

1) Document change
2) When checking if the pagers should be displayed it should be an && not an ||
3) Default should be off not on since that's the way it is now.

Patches attached. Thank you very much.

Is there a way this could work with multi-value image fields? I'd like to hide the pager if there is only one value, and show it if there are more than one.

Hmm, unchecked it looks like this is working now. Thanks?!

I'm seeing this in 6.x but it might be the same in 7.x. I have placed css styles associated with my slideshow-controls-bottom div. I was wondering if instead of the children contents disappearing, the whole div would disappear instead, on one slide. So <div class="views-slideshow-controls-bottom clear-block"> wouldn't be displayed if there is only one slide in the slideshow.

That's harder because the pager doesn't control that div. That div would also include controls and counters or anything else someone comes up with.

Status:Fixed» Active

When the option is checked the pager doesn't show at all even when there are more than one slides. Using latest 7.x devs of core, views and all related modules.

Status:Active» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

@redndahead
I was just thinking of something simple as placing the DIV call within an if|or argument. like if (pager || controls || numbers) {return "$slideshow_control_values" }.

It's probably much more complex then that and in my defense I haven't begun to sort through the code to even assess whether this argument would work.

I'm just a minimalist when it comes to page layout coding and get squirmy when there are DIV tags that have nothing in them. Alas.