Community Documentation

ARCHIVE: Views Carousel

Last updated March 26, 2011. Created by Rob_Feature on October 22, 2008.
Edited by linclark, gecnexus, Gerard. Log in to edit this page.

This documentation page is for the Views Carousel module, which is a Views plugin for outputting content as a jQuery carousel.

5.x-1.x-dev (Drupal 5/Views 1 Version)

Specifics on how to use the 5.x-1.x-dev version of Views Carousel are forthcoming. If you would like to write some documentation, please add it as a comment and we'll roll it into this page.

6.x-1.x-dev (Drupal 6/Views 2 Version)

Creating a Views Carousel is simple. Here's the step-by-step process:

  • Make sure you have Views Carousel and Views 2 installed and you're up and running on a Drupal 6 installation.
  • Go to the Views interface and add a new View. (Views Carousel works with any type of view including users or taxonomy)
  • Set up your View to show the content you want in your carousel using the Filters, etc, then add a new block or page type view.
  • Setting "Row Style" to "field" gives the best result since displaying full nodes in the carousel may be unpredictable.
  • Click the "style" option and choose "Views Carousel". The following options will be available:
    • Grouping Field Allows you to group content by field.
    • Skin This determines the style of your carousel. There are 2 stock skins available and a choice for making your own custom skin.
    • Display Carousel Vertically (checkbox) This is untested as of now. Should orient the carousel in a vertical direction. Most often, the desired orientation is horizontal, in which case this option should be unchecked.
    • First item to start on This allows you to start on an item other than the first one in the sort. For example putting in "2" would make the second item in your View appear first in the carousel.
    • Scroll The number of items each click on the next or previous button will advance the carousel. Do not confuse this option with the autoscrolling option below.
    • Number of items to display in carousel This is currently untested and may conflict with the number of items in your view. Please test and report in the issue queue.
    • Speed of animation This is the speed of the scroll animation which may be 'fast', 'slow', or specified in milliseconds.
    • Name of easing effect This allows you to designate a jQuery effect for the easing behavior. Documentation on the options is found here
    • Autoscrolling Delay If set to a number other than 0, it enables an 'autoscrolling' effect and sets the delay to the number entered in seconds. Autoscrolling means that the carousel will scroll on it's own using an internal timer without any user interaction. A value of 0 disables autoscrolling.
    • Wrap Content This function allows your carousel to go back to the beginning when you reach the end, or to the end when you're at the beginning, or both, essentially allowing the arrow buttons to always move the carousel somewhere.

Theming The Carousel

To theme the carousel requires some CSS skills. Here's some notes on theming the carousel:

  • The height and width of the carousel items are set in the skins CSS files. Override them in your stylesheet to set other height and width. We're investigating whether auto-height and auto-width can be implemented natively.
  • The buttons (prev/next) are also implemented via CSS. Create your own button graphics and override the theme CSS to show your buttons instead.
  • The curved corners on both stock themes are available in Firefox or other Mozilla browsers by using CSS -moz-border-radius. So don't waste your time looking for rounded corner images...there are none in the stock themes.

Please Contribute!

We'd love to see you contribute to this documentation. Please leave your corrections, additions, or subtractions in the comments and we'll add them to this documentation.

Comments

Creating your own views carousel skin

To make your own custom skin for this module requires two basic steps:
* Add the name of your skin to viewscarousel.module
* Create your own skin folder (with associated files)

To do this:
* go to sites/all/modules/viewscarousel/skins and copy the entire tango folder; rename your copied tango folder to "myskin" or whatever
* open up sites/all/modules/viewscarousel/viewscarousel.module and scroll down to the bottom of the file.
* create your own case to handle the params associated with your skin. In my case I just copied:

    case 'tango':
      drupal_add_css(drupal_get_path('module', 'viewscarousel') .'/skins/tango/skin.css');
      return 'jcarousel-skin-tango';
      break;

...and pasted this chunk below the break; in the tango case.
* next, rename case 'tango': to case 'myskin': (must match the name of your skin folder mentioned above)
* change the drupal_add_css path to point to your new css file; the path should be '/skins/myskin/skin.css'
* save viewscarousel.module
* now go to sites/all/modules/viewscarousel/skins/myskin and open skin.css
* do a search/replace for all instances of 'tango' and replace with 'myskin' or whatever you named your folder
* change the css properties as you see fit; save skin.css
* now go back to administer/views and configure viewscarousel to use your new skin. It should show up in the Skin: drop down list

Enjoy!

unfortunately the title says all...

after messing around for hours, i couldn't find PROPER documentation, so i HAD to resort to invent my documentation and in the process, invent my method as well
it is really a unclean BUT working method, for creating custom skins

instructions are the following:

first, we need to edit jcarousel module...
- navigate to jcarousel module directory (/sites/all/modules/jcarousel)
- edit jcarousel.module as following:
_____________________replace this____________________
// Add the skin CSS if it hasn't been added yet.
if (!isset($jcarousel_added['skin'][$skin])) {
if ($skin == 'tango' || $skin == 'ie7') {
drupal_add_css("$jcarousel/jcarousel/skins/$skin/skin.css");
}
elseif (!empty($skin_path)) {
drupal_add_css($skin_path, 'theme');
}
$jcarousel_added['skin'][$skin] = TRUE;
}
_____________________with this____________________
// Add the skin CSS if it hasn't been added yet.
if (!isset($jcarousel_added['skin'][$skin])) {
if ($skin == 'tango' || $skin == 'ie7') {
drupal_add_css("$jcarousel/jcarousel/skins/$skin/skin.css");
}
elseif (!empty($skin_path)) {
drupal_add_css($skin_path, 'theme');
}
else {
drupal_add_css("$jcarousel/jcarousel/skins/$skin/skin.css");
}

$jcarousel_added['skin'][$skin] = TRUE;
}
_________________________________________________
the else clause i added will force jcarousel to map other skin names to their respective paths inside the skins dir.
it will make sure you can add as much custom skins as you want.

following this, we deploy our new skin...
- navigate to jcarousel subdirectory and then skins (/sites/all/jcarousel/jcarousel/skins)
- here create a directory for your new skin and put the files inside
OR
- if you haven't created them yet, duplicate for example, tango to another directory name, and edit the skin as you please
(make sure you edit the directory, files and classes names (inside the skin.css) to match all the same name. use no spaces)

after this, it's time to edit viewscarousel module...
- navigate to viewscarousel module directory (/sites/all/viewscarousel)
- edit viewscarousel.module as following:
_____________________replace this____________________
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['skin'] = array(
'#type' => 'select',
'#title' => t('Skin'),
'#default_value' => $this->options['skin'],
'#options' => array('ie7' => t('IE7'), 'tango' => t('Tango'), 'custom' => t('Custom')),
);
_____________________with this____________________
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['skin'] = array(
'#type' => 'select',
'#title' => t('Skin'),
'#default_value' => $this->options['skin'],
'#options' => array('ie7' => t('IE7'), 'tango' => t('Tango'), 'your_skin_directory_name' => t('your_skin_name'), 'custom' => t('Custom')),
);
_________________________________________________
replace your_skin_directory_name and your_skin_name.
this piece of code adds your skin to the views carousel skin list.

- last... test it!

the versions i used are:
jcarousel 6.x-1.1
views carousel 6.x-2.x-dev (2010-07-11)
drupal 6.17

-LP

Great help, small update

Thanks a bunch, definitely saved some time.

As an fyi, the options_form array that needs to be modified is in viewscarousel_style_plugin.inc as of version 6.x-1.0 stable. Might cause some confusion for folks not using dev.

my bad, actually it is in

my bad, actually it is in viewscarousel_style_plugin.inc in both versions
sorry

-LP

Thanks, similar issue here--

Thanks, similar issue here-- was following old documentation and lost *hours*. Have you filed an issue with this, so it can get cleaned up?

(UPDATE: filing issue myself, please feel free to tell me if I get it wrong).

Custom skin without editing module code

One of the (undocumented) carousel view style options is to use a skin of "custom". If you select that, it will remove the skin identifiers, so you won't see ".jcarousel-skin-tango" on any of the blocks. You still get the other .jcarousel identifiers, however, so you can just add the appropriate rules to your site's CSS file.

To get this working, set the view's skin to "custom." Then make a copy of the "skin.css" file in the Tango skin's folder, and delete every instance of ".jcarousel-skin-tango". (Example: ".jcarousel-theme-tango .jcarousel-container" becomes just ".jcarousel-container") Then copy & paste the contents of that file into one of your theme's CSS files, or otherwise load it directly within your theme.

Unfortunately, the option to add a custom css class to the view doesn't work with this module, so it's not very easy to have different skins for different carousels on your site. But you could certainly theme the view and add additional selectors.

Edit modules dirs is very bad approach

Hi guys,

I am wondering how many comments are proposing to edit the Views Carousel module directory. This only shows that the module is un-customizable as editing module directory is very bad approach. What are you going to do if there is new version of this module? Are you going to back-up all your changes, replace the old module with the new one and then put the changes back on place? Can you imagine if every module developer did this? You would go mad with every update!

All skins and other customizable stuff have to be outside of the modules directory. For now I am giving up on this module but as soon as this is sorted I'll be more than happy to come back. Fingers crossed!

Petiar.

Page status

About this page

Drupal version
Drupal 5.x, Drupal 6.x

Archive

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here