Hi,
I need some way to create x many objects add a clearing class and add another create x many objects add another clearing class and continue. Example = thumbnails of photos in a gallery. Yes i could use a table but I would run into the same problem. The kind of functionality I'm looking for is similar to Even and Odd, but not with a base of 2.
In php i would do something like:
$j =0;
for ($i =0; $i < $total; $i++) {
echo $something;
$j++;
if($j == 5) {
echo '<div class="clear"> </div>';
$j=0;
}
}
What I've done is added the below code to ViewableData:
/*
* Return if we have a complete row or not
* @param int $denominator, which defaults to 1.
* @return boolean
*/
function IsDivisibleBy($denominator = 1) {
if (is_int(($this->iteratorPos+1) / $denominator)) {
return true;
} else {
return false;
}
}
I can then use the below in my template class:
<% if IsDivisibleBy(3) %>
Is there a better way?