how to refer to fields with multiple values in node--content-type template I currently have a template for the article content type. 

node--article.tpl.php contains:

&lt;?php
    print render($content['body']);
    print render($content['field_file']);
    print render($content['field_tags']);
?&gt;


All of those fields are rendered just fine. All the values of field_tags are rendered. However I'd like to be able to refer to each individual value of the tags field.

For instance, I'd like to be able to do

    &lt;span class="customClass i"&gt;field_tag&lt;/span&gt;


and iterate i for each item the field spits out. 

I've made some attempts with no luck. I tried

$i = 0;
while($content['field_tags']){
    print "&lt;span class='customClass ".$i."'&gt;";
    print render($content['field_tags']);
    print "&lt;/span&gt;";
    $i += 1;
}


However that just created an infinite loop. I attempted it with

while(render($content['field_tags']))


as well but that created an infinite loop as well. Is there a way to access the tags field as an array? rather than just one element in the $content array?
I managed to accomplish this by appending [value] to the end of the field_tag array. Then by using the 'count' function I created a for loop to iterate through each value like so

$j = count($content['field_tags']);
for( $i = 0; $i &lt; $j; $j+= 1){
    if(render($content['field_tags'][$i]) != ''){
        print "&lt;span class='customClass ".$i."'&gt;";
        print render($content['field_tags'][$i]);
        print "&lt;/span&gt;";
    }
}


Note: For some reason I had to insert a check for if the tag was empty because the array ended up being a lot larger than the number of the tags.