Hello,
I'm working with the jCarousel plugin and would like to have multiple
carousels on one page, each dynamically pulling the scrolling items
from an array. I am wondering what sort of modifications I would need
to make to the jcarousel_functions.php file and page xhtml to
accommodate 2+ instances?
Here's my sample:
http://static.spartaninternet.com/sandbox/carousel/And here is the code from the jcarousel_functions.php file:
<?php
$jcarousel_items = array(
array(
'title' => 'Face 1',
'src' => 'images/thumbs/beach.jpg',
),
array(
'title' => 'Face on a dock',
'src' => 'images/thumbs/beach2.jpg',
),
array(
'title' => 'blue monkey face',
'src' => 'images/thumbs/beachsunset.jpg',
),
array(
'title' => 'scooter face',
'src' => 'images/thumbs/frogs.jpg',
),
array(
'title' => 'fun face',
'src' => 'images/thumbs/market.jpg',
),
array(
'title' => 'Flower 6',
'src' => 'images/thumbs/monkey.jpg',
),
array(
'title' => 'Flower 7',
'src' => 'images/thumbs/monkey2.jpg',
),
array(
'title' => 'Flower 8',
'src' => 'images/thumbs/rooftops.jpg',
),
array(
'title' => 'Flower 9',
'src' => 'images/thumbs/volcano.jpg',
),
array(
'title' => 'Flower 10',
'src' => 'images/thumbs/waterfall.jpg',
),
);
/**
* This function returns the number items. Typically, this
* would fetch it from a database (SELECT COUNT(*) FROM items) or
* from a directory.
*/
function jcarousel_countItems()
{
global $jcarousel_items;
return count($jcarousel_items);
}
/**
* This function returns the items. Typically, this
* would fetch it from a database (SELECT * FROM items LIMIT $limit
OFFSET $offset) or
* from a directory.
*/
function jcarousel_getItems($limit = null, $offset = null)
{
global $jcarousel_items;
// Copy items over
$return = $jcarousel_items;
if ($offset !== null) {
$return = array_slice($return, $offset);
}
if ($limit !== null) {
$return = array_slice($return, 0, $limit);
}
return $return;
}
?>
Thanks!