Wednesday, 28 August 2013

Different css styling for last element of a php array Pt.2

Different css styling for last element of a php array Pt.2

Ok here is my new issue, and a complete description of what I am trying to
accomplish. I used the suggestions you gave me and it worked fine, but
when I changed the ORDER by information to a different field and the if
statement, it went crazy. Here is what I need, I have two columns on a
page, when the array is processed I need it to display results filling
each column left to right top to bottom. There is a division line between
each item ( ) and one under each item ( ). If the item is the 3rd, 5th,
7th and so on… it will be on the left and does not need the "vLine " div
before it and if it is the last item(s) it does not need the "product-col"
div under it as the last 2 items do not have to have the bottom divider,
but if it is only two items on the whole page the bottom divider can stay.
What am I doing wrong?
<?php $count_temp = count ($productid); for ($i = 0; $i < $count_temp;
++$i) {$artist = get_the_title(); if (($productartist[$i] == $artist ) &&
$categoryID[$i] ==1 ){?>
//Content//
<?php if (!($i === 0) && !($i % 2) && ($productid[$i] == 1) && ( $i ===
(count ($productid) - 1))){ echo'<div class="product-col-none" >';} else
{ echo '<div class="product-col" >';} ?>
//Content//
<? if !( $i === (count ($productid) - 1)){ echo '<div
class="centerBoxContentsFeatured centeredContent back vLine "
style="width:50%;">';}
else { echo '<div class="centerBoxContentsFeatured centeredContent back "
style="width:50%;">';} ?>

No comments:

Post a Comment