I have a content type with a fiel called: fotos-carousel (image type) which I want to show as a carousel. I can’t use views to do this.
I installed the jcarousel module and read the documentation to add a carousel programmatically.
Then I create a tpl file to change the output of this field: field–field-fotos-carousel.tpl.php
and add this code:
<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>> <?php foreach ($items as $delta => $item) : ?> <?php $items_carousel[]='<img src="sites/default/files/'.$item['#item']['filename'].'" width="75" height="75" alt="" />'; ?> <?php endforeach; ?> <?php $options = array ('visible' => 1,'scroll' => 1,); print theme('jcarousel', array('items' => $items_carousel, 'options' => $options)); jcarousel_add('.jcarousel-id-1', array('vertical' => TRUE)); ?>
The output (ul, li, images) is fine but the carousel is not loaded (jquery)
Anyone has done this before? What am I missing?