Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modulo and End PHP
<div class="block_content">
<?php $c = 0; foreach ($dossiers as $k => $dossier):
if ($c % 4 == 0) print '<div class="clearfix">';?>
<div class="dossier <?php if ($k % 4 == 3) print 'last'; ?>">
<?php if (!empty($dossier->article_image_filepath)): ?>
<a href="<?php print url('node/'.$dossier->nid); ?>"><?php print theme('imagecache', 'op_list', $dossier->article_image_filepath, '', '', array('class' => 'dossier_img')); ?></a>
<?php endif; ?>
<h4><a href="<?php print url('node/'.$dossier->nid); ?>"><?php print $dossier->title; ?></a></h4>
</div>
<?php if ($c % 4 == 3 || $count == (count($dossiers))) print '</div>';
$c++;
endforeach; ?>
</div>
<?php end($rows); $lastk = key($rows); foreach ($rows as $k => $row): ?>
<div class="article_row <?php if ($k == $lastk) print 'last'; ?> clearfix">
<?php echo the_content(); ?>
</div>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment