A recent project put us in need of a carousel. Jcarousel provided the basics for what we needed however we had to add some additional love to get the carousel working the way the client envisioned.
We had to theme the block.tpl file for the carousel, using PHP to achieve our goal. The biggest issue we needed to address was that the carousel would need to start on the same thumbnail (depending on a page's parent) whether it was on a parent or child page. So even though jcarousel provides a way to start the carousel on a particular thumbnail, we needed a dynamic way to do that since the "home" thumbnail changes throughout the site depending on which project you are on. If you land on Parent A or on anyof Parent A's child pages, the carousel needed to start withProject A's thumbnail.
First we needed to control project parents vs. project children. We used 2 content types for this, with a selector on the child type so we could choose which project parent it belonged to. We added a CCK field to project parents allowing them to choose a carousel ordering.
Next we created a view that pulled the parents as a simple HTML list. Each parent also has a huge background photo, so we used imagecache to create a thumbnail from this for the carousel. The view was shown in a block, whose view-view-list--carousel--block.tpl.php file we themed. We loaded the node form the block:
$nodeid = (arg(0) == 'node' && is_numeric(arg(1)))?arg(1):FALSE;
$node = node_load($nodeid); $nid = $node->nid;
Once we determined the parent (or found out we were already on a parent), we could grab the carousel order from the CCK field of the project we were on so we could tell jcarousel to $start on that item. We also used jquery to provide an active class to the current list item since Drupal wouldn't necessarily do that if were on a child page.
Using the technique above we were able to create a carousel that starts at an appropriate place even if we aren't specifically on that page. As long as we're on any of a project's pages, the carousel starts correctly and we can even style it as such with the addition of an appropriate active class.
You may still be able to see the carousel at QuinnEvans.com in the project section.
M. S., Owner IndigoPark
John is a rare talent with the ability to cross over between design and programming. Willing to find programming / css solutions to almost any design challenge. I can always count on John to produce clean, efficient and thoughtful websites. John is a great resource, always on top of the latest industry trends. He is the BEST!