I am sure that someone has done this before, but for some reason I can't get the code through my thick skull.
I am wanting to evenly distribute the contents of a replicant between two columns, so if there are 9 items, it would be 5 in the first, and 4 in the second.
Here is what I have so far,
<iw_iterate var='row1' list='dcr.boxed_content_row1' iteration='count'>
<iw_perl>
my $number = iwpt_dcr_list('dcr.boxed_content_row1 ');
if (!($number % 2 == 0)) {
$number = $number + 1;
}
my $div = $number/2;
my $count = $count;
my $title = iwpt_dcr_value('row1.TITLE ');
my $content = iwpt_dcr_value('row1.CONTENT');
if ($count <= $div){
$firstcolumn .= "<div id=\"sub5\">$title</div>$content");
}
else {
$secondcolumn .= "<div id=\"sub2\">$title</div>$content");
}
</iw_perl>
</iw_iterate>
<table>
<tr>
<td><iw_value name='$firstcolumn'/></td>
<td><iw_value name='$secondcolumn'/></td>
</tr>
</table>
does this look right? is there a better way to do this? I know i could just make two replicants for the two columns, but I think this is a cleaner solution so the user doesn't have to worry.
Just updated the code, I think this is right now...
Edited by kellyrmilligan on 12/28/05 01:40 PM (server time).