I currently have a template for the article content type.
node--article.tpl.php contains:
<?php
print render($content['body']);
print render($content['field_file']);
print render($content['field_tags']);
?>
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
<span class="customClass i">field_tag</span>
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 "<span class='customClass ".$i."'>";
print render($content['field_tags']);
print "</span>";
$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?