What I am working with it this. I have a custom content type with an image field (field_img) that accepts multiple images so they are stored in an array. what I need to figure out how to do is one of two things and I need to do them from the node--custom.tpl.php if possible.
1: get the size of the $node->field_img array so I can then loop through and assign appropriate HTML id's for each image in the content type.
2: directly loop through the field_img array using maybe foreach() to set the id of each image in the content type to an appropriately unique value.
what I am able to do here works for one value because I can put in the actual index of the instance I am working with but the arrays are not all the same length some have 10 images some have only 6 so I need something that will loop through the array.
Here is the static code that works for one element
<div id="gallery-img-wrapper"> <?php $i = 0 ?> <img class="album-image<?php print $i ?>" src="<?php print render (file_create_url($node->field_img['und'][$i]['uri'])); ?>"> </div>
this is inside node--gallery.tpl.php and it works fine but it only displays 1 image and I need 14 or how ever many there are for the instance of the content type.