Hi there,

First off, thanks so much for making an AJAXy slideshow module! Especially for those of us whose website users don't have highspeed internet, none of the alternatives are very palatable.

I was going to make this a feature request, but I've not been playing with the module very long, so I'm not sure it can't already be done. Basically I'd like to have different slideshows (though not on the same page). The kind of thing I'd like is to be able to

  1. specify an argument to the view - for example a taxonomy term - and then when I go to slideshow-front/happy the term happy can be used to narrow down the nodes that are used for the slideshow.
  2. create a new view entirely, and set it up as another slideshow - ideally this would also involve changing the global settings (admin/settings/ajax_slideshow) so that they are view-specific (ie different settings for the different views).

    Is that possible at the mo? Any plans? I might be able to help out, though I haven't taken a look at any code yet, so don't want to speak too soon;)

    Cheers,

    Andy

CommentFileSizeAuthor
#6 ajax_slideshow_view_args.patch1.12 KBandyf

Comments

udig’s picture

Hi Andy,

Thanks for your supportive words.
Answers to the above questions:
1. It is possible to use arguments within the ajax_slideshow view. In general setting the filtering (including arguments) and sorting of the ajax_slideshow view is supported.
2. Unfortunately at this point multiplicity of view is not supported. If you'd like to contribute this code, you're most welcome!

Thanks and enjoy the module.
Udi.

andyf’s picture

Hi Udi,

Thanks for the response.

It is possible to use arguments within the ajax_slideshow view.

I don't know what I'm doing wrong then. I've modified the default view only to limit it to my current language and Image content type. This works fine. Then I specify an argument of Taxonomy: Term ID. This works fine in the live preview for the view, but when I actually browse to /slideshow-front/1 I get the slideshow with all the images, not just those tagged with the first term. I've tried using Taxonomy: Term as well, with exactly the same effects.

Any ideas?

Thanks,

Andy

udig’s picture

Make sure you did not change the row style or *any other* setting other then the argument / filter / sort. To ensure that there are no changes to the original view, revert the view to its default state and make the changes only to the argument area - do you get the right results?
Another option - I'd ignore the views preview results. I'd copy the view to a temporary view with a different name and check the actual results outside of the slideshow context (i.e. nodes presented as a plain list).

andyf’s picture

Still no joy. I've done a fresh install with only the minimal modules to run ajax_slideshow and use imagefield. It's the same as before. At first the slideshow loads as expected, showing all nodes. Then I created a tagging vocabulary for content type Image. I modified two of my three images to have a tag. I modified the default view only by giving it an argument. The argument worked on preview and when cloning the view as you suggested. However I get the same slideshow whether or not I use an argument in the address bar. (And again I tried both the term, and the term ID.) I notice that when I hover over the tabs, they display a link of the form slideshow-front/1. Do you think the code handling that is interfering with the argument?

udig’s picture

AndyF

I tried it myself and found out that I am so wrong!! I am terribly sorry for misleading you - I overlooked the fact that the view is triggered from within the code (not a page). currently the code does not pass the arguments portion of the URL into the view hence no arguments-based filtering takes place.

Now, since I felt so bad about you wasting your time due to my incompetent answer, I worked out a quick solution for this (sorry for not providing a patch).

In ajax_slideshow.module at line 211 (assuming you use V2.x) you will find the following line:

$tabs_view = views_embed_view('ajax_slideshow_view', 'default');

Please *replace* this line with the following code:

$arguments = explode('/', $_GET['q']);
array_shift($arguments);
$arguments = (count($arguments)>0)? $arguments : null;
$tabs_view = views_embed_view('ajax_slideshow_view', 'default', $arguments);

The above change is supposed to provide support for passing arguments into an ajax_slideshow which is not positioned as a block.
I will make sure this patch finds its way into the next release of the module.

Please let me know if this worked for you.

Udi.

andyf’s picture

Category: feature » support
Status: Needs review » Active
StatusFileSize
new1.12 KB

Hi Udi,

Sorry, got sidetracked this past week. Just need to make a slight change to your code, as views_embed_view() doesn't accept an array of arguments. I've used call_user_func_array() instead. The attached patch works for me.

Thanks for your help,

Andy

andyf’s picture

Category: support » feature
Status: Active » Needs review
udig’s picture

Category: support » feature
Status: Active » Needs review

AndyF,
Cool!
(I'm a bit overwhelmed with customer work load at this point, hence it will take me a while to review and integrate the above but I'll get there.)
Thanks a lot mate.

udig’s picture

Version: 6.x-2.0 » 6.x-3.0
Status: Needs review » Closed (fixed)

Added to V6.3.
Supported only for node-based slideshow (see source mode setting)

ncazanav’s picture

I clearly see that the code restr


  // Arguments support - contributed by AndyF - http://drupal.org/node/831586 
  $arguments = array();
  if ((!$is_block) && (variable_get('ajax_slideshow_content_source','node_based') == 'node_based')){
    // Pass on the URL arguments to the view. This assumes that the first path
    // argument is the slideshow path, and the other path args are for the view.    
    $arguments = explode('/', $_GET['q']);
    array_shift($arguments);  // Remove slideshow path
  }
  array_unshift($arguments, 'ajax_slideshow_view', 'default');
  $tabs_view = call_user_func_array('views_embed_view', $arguments);

  return theme('ajax_slideshow', $tabs_view);

Could you explained why this restrction? Why not also for views-based slideshow?