I have a view output that shows user-profiles. Each view is a group on it's own and has a maximum of ten members. How can i show always ten items, if there are currently -let's say- only 7 assigned? So it would show 3 empty slots with maybe a custom text.

I don't find any logic that's out-of-the-box views behaviour for this. Can someone please point me in the right direction?


EDIT: Adam Balsam pointed out the grid format, which has an autofill feature. Unfortunately it's just an empty table row that is created. It's also not useable for responsive layouts... bummer.

2 Answers 2


You can add the empty rows to the view in the View's Style output template. Assuming you are using the unformatted style, the template name would be views-view-unformatted--[view-name].tpl.php.

Using the default views-view-unformatted.tpl.php as a starting point, add the following to the top of your custom template:

$num = count($rows);
$add = (10 - $num);
for ($i=0;$i<$add;$i++) {
  $rows[] = '<div>Empty Row</div>';
  $classes_array[] = 'views-row views-row-' . ($num + $i);

If you're worried about the views-row-last classes, etc, the same sort of logic could be applied earlier in the view build process using something like hook_view_pre_render(), but depending on your scenario, the above should suffice.

  • I'll test this. Thanks! I knew that I couldn't escape custom templates forever...
    – Volker
    Apr 24, 2013 at 15:38

You could use the Grid format and select the "Fill up single line" checkbox. Make sure you have entered either 5 in the "Number of columns" textfield and display 10 items in the pager settings.

That would fill each row with empty <td> elements.

Note: If you have less than six results, it will only fill the first row; so this isn't a perfect solution.

  • Nice catch. Unfortunately the grid format isn't quite useable for my usecase. It just adds empty table rows, but I need at least some text to add here, so some kind of field would be great.
    – Volker
    Apr 24, 2013 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.