I am creating theming view using row style theme named as
views-view-fields--slider-block.tpl.php
and here is code for it:
<?php
$string='<div id="slider"><ul>';
foreach($fields['field_slider_image_fid']->handler->view->style_plugin->rendered_fields as $row) : ?>
<?php $i=1; ?>
<?php $i=$i+1;?>
<?php
if($row['field_image_position_value'] == 'left') {
$string.="<li>
".$row['field_slider_image_fid']."".$row['field_image_text_value']."</li>";
}
else {
$string.="<li>".$row['field_image_text_value']."".$row['field_slider_image_fid']."</li>";
}
?>
<?php endforeach; ?>
<?php
$string.="</ul></div>";
echo $string;
?>
Now it is working fine when there is exactly one node in the view. But a problem occurs when the view contains more than one node, e.g. if the view contains 5 nodes, this template renders 5 times causing duplication.
Anyone have ideas on how to resolve this?