5

The rotating images on my work site's home page are created as a View in list format. I'm using the jQuery Cycle Lite plugin for the rotator effect. The cycle.lite.js file is set in the scripts array in my theme's .info file, and there's a bit of code in page.tpl.php to check whether this is the homepage, and if so, set up the rotator.

Now I'm working on a second rotator for another section, and I've been trying out the Views Slideshow module.

What are the pros & cons of each approach (theme vs module), especially from a server load or page weight point of view?

4

I personally try to avoid using any Views jQuery modules for popular jQuery plugins and prefer just to add the jQuery plugin directly to my theme by adding the .js file to my theme.info file. I will then create another .js file that runs on load that instantiates the jQuery plugin.

I use Semantic Views module which allows you to tune the output of the view to your liking. I will use this module to output the markup in a compatible format for use with the jQuery plugin.

I find that if you use a Views plugin module for something like jQuery Cycle or jCarousel for example, you are limited by the options exposed by that plugin. I prefer not to rely on a 3rd party module which may not support the latest changes or all the features of that latest jQuery plugin.

I would expect there would be a very minimal overhead using if any at all using a Views plugin instead of using the jQuery plugin natively.

  • I think this is the direction I'm going to go, especially since I had a lot of trouble configuring/fine-tuning Views Slideshow. Thank you for the pointer to Semantic Views -- that should help me generalize my classes to make the JS tidier! – epersonae Mar 3 '11 at 21:08
  • And actually, I didn't even need Semantic Views for this, although I'm going to keep it as an idea for other stuff. Just (!) discovered the "CSS class" setting, which is enough to create a hook to use the JS on very different Views. And this way, if I decide I want to use a different jQuery plugin, I don't have to change Drupal modules. – epersonae Mar 4 '11 at 16:28
  • Great I'm glad you've found a good solution. I think it's much easier to control and support long term when you don't to rely on other peoples code. – Camsoft Mar 4 '11 at 17:04
2

I can't speak to any specifics on performance of Views Slideshow, but it is a very widely used module, and performs well on many large sites.

In general I find it best to go with the most popular solution when working with Drupal if it fits your needs, this usually means others have put it through its paces and helped iron out any weaknesses.

There is also the added benefit that maintaining any necessary updates will be far easier with the less custom approach of Views Slideshow.

1

When I started to build Drupal sites I did what Camsoft is suggesting. I used views tpl files to generate only the html I needed and I used jQuery Tools to add effects. The end result was very clean code and less reliance on contrib modules. However, I ended up with many tpl files I had to maintain. Also, since I created custom solutions, I was the only one testing them. After building many sites, I have come to believe that using contrib modules is the way to go for the reason pointed out by Mark Ferree. Using Semantic Views gets me almost the code I want but the speed advantage is tremendous. So if you build Drupal sites for a living I would recommend to use contrib modules and to look at the underlying jQuery plugins so you understand the settings.

  • Some links with references would be nice here. – Letharion Nov 21 '12 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.