Multiple items displayed...

cardell - September 17, 2008 - 11:04
Project:Views Rotator
Version:6.x-1.0-alpha
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

Is it possible, or planned, to display multiple items from the generated view rather than just one item?

So...
node1
node2
node3

node4
node5
node6

Thanks...

#1

mfer - September 17, 2008 - 14:52
Status:active» postponed

Displaying multiple items won't be in the 1.0 release. It's a good idea and might come in later releases.

I understand your need and have built multi-item rotations before. Before I look into that I want to make the basics feature complete and solid. This would have to come in a later version.

#2

msoler75 - January 1, 2009 - 19:17

I've modified the views-view-rotator.tpl.php to obtain these effect (very useful)

<ul>
<div class="item-list views-rotator <?php print $views_rotator_id ?> clear-block">
  <div id="<?php print $views_rotator_id ?>">
<?php $i = 0; $step = 3; $nitems = count($rows); $npages = $nitems/$step;?>
<?php for ($pages = 0; $pages < $npages; $pages++): ?>
<div class="views-rotator-item"<?php if (theme('views_rotator_display_item', $views_rotator_id)) print ' style="display: none;"' ?>>
<?php for ($items = 0; $items < $step; $items++): ?>
<?php $row = $npages>1?$rows[$i%$nitems]:$rows[$i]; $i++; ?>
<li><?php print $row ?></li>
<?php endfor; ?>
</div>
<?php endfor; ?>
  </div>
</div>
</ul>

Note the variable $step, it is the number of items in each view.

If there is a cycle (more than 0 transitions), in the last transition may "lose" or show empty elements (for example, if $step is 3 and there is 4 total items, the last view only shows 1). I've solved this with the $i%$nitems (it shows the first elements again). I think it is better visual.

You must think that the javascript that do the cycle effect no knows about items, it only understand the html code inside "div class=views-rotator" . I only expanded the code inside to include more than 1 $row.

You can erase the "ul" and "li" if don't want html lists.

Thanks for this great and necessary module.

#3

szy - January 7, 2009 - 03:18

@msoler75 - thanks a lot, it works fine :]

Szy.

#4

Eliza - June 22, 2009 - 04:25

Is it possible to do this trick using grouping field - show one group at a time? At the moment in rotate style options there is no grouping field option at all.

 
 

Drupal is a registered trademark of Dries Buytaert.