I'm running sum basic content from a XML file and have the below which outputs things ok.My problem is when I try and use an if else statement to supply a div class="last" to every third element, it adds it to all the div elements.

which should work even if the $hotels->hotel array is associative.Also I have made class a variable eliminating the IF statement for output AND allowing you to use the same code to insert other attributes to the div or target different divs w/o much alteration.

hope that helps

computerbarry
—
2013-03-14T20:33:21Z —
#7

Cool thanks.I just need to understand this now

Ok, was missing a closing > on the div, that's fixed.Works good now but, seems to be adding the class to the first and forth divs?

Something to do with

<?php $clss= ($i % 3 == 0)? 'class="last"':'' ?>

updateIf I change the 3 to a 2 its works - the problem is that its also adding the class to the first div.How do I stop this happening?