I am sure this is a simple principle of PHP, however it is one I am yet to learn. In principle the code works:
<?php
for($i=0;$i<count($photos);$i++){
if($photos[$i]->image != ""){
if(JPATH_ROOT.'/images/'.$row->id.'/medium/'.$photos[$i]->image){
if(!$photocount) {
$photocount = $photocount + 1;
$photoclass = "property_photo_main property_photo_main_" . $photocount; // First Photo Class
}
?>
<img src="<?php echo JURI::root()?>images<?php echo $row->id;?>/medium/<?php echo $photos[$i]->image?>" class="<?php echo $photoclass; ?>" alt="<?php echo $photos[$i]->image_desc;?>" title="<?php echo $photos[$i]->image_desc;?>"/>
<?php
}
}
}
?>
That outputs the images correctly, however the "Photo Count" does not increase and thus each photo gets the "First Photo Class" (property_photo_main_1). I fully appreciate that the problem here is because the count is not within the loop to print each photo, but as that is directly before that image output, where is the loop, and how can I implement that the count increases?
The HTML Output is:
<img src="http://msa.eighttwentydesign.com/images/osproperty/properties/5/medium/51384100282240dc03c72cb44ce05eb9e56021d0c05.jpg" class="property_photo_main property_photo_main_1" alt="" title=""/>
<img src="http://msa.eighttwentydesign.com/images/osproperty/properties/5/medium/51384100283f9f748ca556070c2d09553298dc26d8f.jpg" class="property_photo_main property_photo_main_1" alt="" title=""/>
<img src="http://msa.eighttwentydesign.com/images/osproperty/properties/5/medium/51384100283b280e25f329d8cf1518bda4700b07765.jpg" class="property_photo_main property_photo_main_1" alt="" title=""/>
<img src="http://msa.eighttwentydesign.com/images/osproperty/properties/5/medium/51384100283c801f9afb73308c7fd77a77ea00129bb.jpg" class="property_photo_main property_photo_main_1" alt="" title=""/>
</div>