Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top