I am developing a slideshow that shows nodes with views_slideshows embedded in them with views_attach. Having some issues with the 2.x branch and the singleframe plugin so trying out the 3.x branch. I see that if you have a node row type that you lose the pager option. I gather this is because it uses fields for pagers and with nodes, you have not fields for the pagers.

My question is, as you can now make your own pagers, if I made one, could I get around the fields issue, or should am best to just head down a different avenue so to speak. Thanks,

Comments

redndahead’s picture

Title: No pager available for 'node' row type » Make views slideshow compatible with node displays.
Version: 6.x-3.x-dev » 7.x-3.x-dev

Node display currently has issues in 3.x. I'll need to look into this further.

maddentim’s picture

I ended up making what I needed out of the 2.x branch. The 3.x branch does look promising and will look at it for future projects. Thanks.

ultimateboy’s picture

Category: support » feature

I'm definitely looking for this functionality as well. I'd love to be able to use views_slideshows with node display instead of field, but the lack of a pager is a game stopper. I think what makes the most sense is to create a new pager for views that use "content" instead of "fields" which uses the node title by default. I started to try to get this to work, but I'm definitely stuck.

I've added a new widget to hook_views_slideshow_widget_pager_info(), added an entry to hook_theme with the same name, and began writing the preprocess code to add the titles. I thought I could get tricky and try to simply emulate exactly what $rendered_fields .= theme('views_slideshow_pager_field_field', array('view' => $vars['view'], 'field' => $field, 'count' => $count)); from _views_slideshow_preprocess_views_slideshow_pager_fields() does by hardcoding the divs. I ended up with something like this:

    $vars['classes_array'][] = $vars['attributes']['class'];
    $vars['widget_id'] = $vars['attributes']['id'];
    $vars['classes_array'][] = 'views_slideshow_pager_fields';
  
    $vars['rendered_field_items'] = '';
    foreach($vars['view']->result as $count => $node) {
      $rendered_fields = '';
      $node = node_load($node->nid);
      $rendered_fields = '<div class="views-field-title"><div class="views-content-title">' . l($node->title, 'node/'.$node->nid) . '</div></div>';
      $vars['rendered_field_items'] .= theme('views_slideshow_pager_field_item', array('vss_id' => $vars['vss_id'], 'item' => $rendered_fields, 'count' => $count, 'location' => $vars['location']));
    }

This actually all appears to work, sort of - the titles get displayed as pager items, and all is well and good... but the JS doesnt fire. Clicking on the titles simply takes you to the node itself and doesnt advance the slideshow. I feel like I'm missing something pretty obvious here, but I cant seem to figure out what it is. Any chance you could give me a hint of how the JS functions and what might be stopping the above from functioning correctly?

ultimateboy’s picture

Finally figured it out. The JS was getting hung up on if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) { because I wasnt including the activePauseOnHover setting in my preprocess...

  // Build our javascript settings.
   $js_vars = array(
     'viewsSlideshowPagerFields' => array(
       $vars['vss_id'] => array(
         $vars['location'] => array(
           'activatePauseOnHover' => $vars['settings']['views_slideshow_pager_fields_hover'],
         ),
       ),
     ),
   );

   // Add the settings to the page.
   drupal_add_js($js_vars, 'setting');

If you like the general approach, I'll submit a patch.. it feels a tad hackish and I don't even want to think what happens if you try to build a slideshow out of non-node entities, I'd assume this approach would fail beyond belief.

headstartcms’s picture

I have problem with the slideshow module it doesn't appear on the block. All modules are already installed yet i cannot find the slideshow module. How does this module work ?

ultimateboy’s picture

Jazclick, it's probably best for you to create a new issue with things like this instead of extending this one which is about a very specific feature request to the module.

Views slideshow, works, as the name would suggest, with the views module. It provides a display type to display the results of a view in a slideshow. I encourage you to watch some of the many screencasts out there on using views and/or specifically about views slideshows. Thanks!

longwave’s picture

I made a simple module that implements a numbered pager for node displays and uploaded it to a sandbox: http://drupal.org/sandbox/longwave/1340916

longwave’s picture

Title: Make views slideshow compatible with node displays. » Make views slideshow pager compatible with node displays

Improving title.

liebezeit’s picture

longwave, your code doesn't work if the "hide if there is one slide" checkbox is checked.

longwave’s picture

That's why it's in a sandbox ;) It's only been briefly tested and works for my use case but probably not with many of the myriad of options that Views Slideshow offers.

You can post issues against the sandbox at http://drupal.org/project/issues/1340916

jason.fisher’s picture

Following..

anthonyR’s picture

Thanks for this sandbox. I'm using it right now :)

Simon Georges’s picture

Thanks for the sandbox, I'm using it (and it works). +1 for a patch to Views Slideshow core module!

mstrelan’s picture

+1 on the sandbox project being awesome.
+1 on #9 re: hiding if one slide is broken

To fix #9 just change the && to || in if (empty($vars['settings']['hide_on_single_slide']) && count($vars['view']->result) > 1) {

This is the same problem views_slideshow had recently and has recently been fixed.

gthing’s picture

I enabled the sandbox module, and can now enable the pager in the slideshow settings. However, the only option for "pager type" is "simple counter." So for my five slides, I can see the numbers 1-5, but I can't click on them to jump to that slide. What am I doing wrong?

broon’s picture

So finally, I am on a project where I need a Views Slideshow. And I need a pager for display type "Content".

I installed the sandbox module from #7 and fixed the issue from #9 with comment #14.

Now, In encountered the same thing as gthing, it's nice to finally have a pager, but it's not clickable, thus it's not really useful yet. I was going through the module files of both Views Slideshow and Views Slideshow Simple Pager and finally came up with this one line solution (it's a long line, though):

Add the following at the end of the file views_slideshow_simple_pager.module right after the drupal_add_js(..) (line 44):

drupal_add_js('var uniquePagerID = 
jQuery(".views-slideshow-pager-field-item").click(function() { var eID = jQuery(this).attr("id").replace("views_slideshow_pager_field_item_bottom_",""); var ssID = eID.substring(0,eID.lastIndex("_")); var sN = eID.substring(eID.lastIndex("_") + 1); 
Drupal.viewsSlideshow.action({ "action": "goToSlide", "slideshowID": ssID, "slideNum": sN });  });', 'inline');

Note that this code is for a bottom pager, replace bottom with top if your pager is at top position.

jenlampton’s picture

The solution above did not work for me, but adding anchor tags to the fields output seemed to do the trick. Patch offered on the sandbox at http://drupal.org/node/1631782#comment-6111594

anthonyR’s picture

I did what @jenlampton did as well. The controls' markup can be overridden (see views_slideshow templates) and you can transform them in A tags which makes them clickable and focusable.

klonos’s picture

+1 for a patch (or submodule perhaps?) in the views_slideshow project. I'm using Views Slideshow Simple Pager sandbox too (+ the patch from #1631782: Allow pager to be clickable) for now ;)

webadpro’s picture

Views Slideshow Simple Pager's code should be added into this module.

Alex Andrascu’s picture

Any news about this ?

donquixote’s picture

+1, I am very interested in this.

headstartcms’s picture

Thanks for the response!

Kristi Wachter’s picture

Issue summary: View changes
Status: Active » Reviewed & tested by the community

Can we consider this RTBC, since several users have reported using the sandbox module with good results?

iLLin’s picture

A simple fix for anyone that is interested, put this in your custom node template.

// Views Slideshow addition as we lose our content array when rendering
// through views as content instead of fields.
if(!is_array($content) || empty($content)) $content = node_view($node);

This will populate the content array for you.

aaron’s picture

Status: Reviewed & tested by the community » Needs work

Nothing to commit.

vbouchet’s picture

I also faced this issue for a customer and I developed a module to render entities in the pager. I based this module on Views Slideshow Simple Pager.

NickWilde credited bleen.

NickDickinsonWilde’s picture

Title: Make views slideshow pager compatible with node displays » Add simple numeric pager to Views Slideshow.
Status: Needs work » Fixed

  • NickWilde committed 7b3461f on 7.x-3.x
    Issue #1168658 by longwave, NickWilde, jenlampton, anniegreens, bleen:...
NickDickinsonWilde’s picture

Thanks to Longwave for creating this, and to Jen Lampton, Anniegreens and bleen for the patch in #1631782: Allow pager to be clickable. Now merged in - with some default styling as well.

Status: Fixed » Closed (fixed)

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