Hey. This "could" be the module I've been looking for, but it isn't... I need a way of limiting my "grid" to 5 items per group (for my arcade index page) how could I go about this? I cannot use this module in conjunction with the Grid style in views.

It would be awesome if this was implemented. Maybe add this module as a setting rather than a style :)

Comments

theunraveler’s picture

Yes, I would love to implement this as a setting of some sort rather than a style plugin, but sadly it is not possible using the current Views API. I hear that it will be possible in Views 3, however!

Until then, you can still get a grid view by leaving your style plugin as "Grouping Limit", but overwriting the views-limit-grouping.tpl.php file and putting something like the follow in.

<div class="views-limit-grouping-group">
  <?php if (!empty($title)): ?>
    <h3><?php print $title; ?></h3>
  <?php endif; ?>
	<?php $i = 0; ?>
  <?php foreach ($rows as $id => $row): ?>
   	<div class="<?php print $classes[$id]; ?> row-<?php print $i; ?>">
     	<?php print $row; ?>
   	</div>
		<?php if ($i < 4): ?>
			<?php $i++; ?>
		<?php else: ?>
			<?php $i = 0; ?>
		<?php endif; ?>
  <?php endforeach; ?>
</div>

That'll give you the classes you need to style up a grid that goes 4 across (change the 4 to anything else to make your grid have more columns). Hope that helps!

theunraveler’s picture

Status: Active » Closed (works as designed)
darklight’s picture

Awesome, the code looks great! I haven't got time to test this right now, but I see the logic... I will take a look later tonight and give feedback :)

Thank you for your support.

jp2020’s picture

Hi Jacob,

Thanks for posting the above (extremely helpful), but I do not know how to CSS the above into 4 columns. Could you please provide the CSS code?

I am thinking that there are others that have reached this point and not contacted you because they need to resolve their items right then and there, so I am thinking this would be helpful for others as well, and would also suggest placing a link to this tutorial on the module page, so that others are able to style right away. I have spent the past 3 hours trying to figure out things, and deciding where to post the question about the CSS - I am thinking that others would need a whole lot of explaining before they grasp it.

theunraveler’s picture

Sadly, I'm not much of a front-end designer, so my CSS is a bit rusty.

My best advice would be something like the following:

div#views-limit-grouping-group div.views-row {
  float: left;
}
div#views-limit-grouping-group div.views-row.row-4 {
  clear: both;
}

That should give you a very basic 4-column grid. Again, I'm a bit rusty with CSS, so maybe someone else can answer your question better. In fact, your issue is not with this module at all, but with basic CSS. I would suggest some place like Stack Overflow, where your question with be answered a lot quicker than if it's sitting in this module's issues queue.

jp2020’s picture

Thanks for getting back with me and for the tip. I will post here when I get further information. Thank a lot - great follow up.

K-stor’s picture

@theunraveler
Do you have any plans to output a version that will be available as a filter for the grid format for example ?