1

I like to wrap 3 elements of a view in a div. I got this code, but it doesn't seem to work. It keeps printing the div but never the /div which makes everything nested in the previous row.

<?php if($i % 3 == 0){ print '<div class="row">'; } ?>
<?php print $row; ?>
<?php if($i % 3 == 2){ print '</div>'; } ?>

Any suggestions?

2 Answers 2

0

Semantic Views module will let you configure HTML output easily.

0

I found the solution.

<?php $i = 0; foreach ($rows as $id => $row): ?>
<?php if($i % 3 == 0){ print '<div class="row">'; } ?>
<?php print $row; ?>
<?php if($i % 3 == 2){ print '</div>'; } ?>
<?php $i++; endforeach; ?>

I forgot to define $i before foreach en $i++ before endforeach.

Your Answer

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

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