您需要使用“行样式输出”模板(例如views-view-fields.tpl.php)。
为了使它对您的视图唯一,您需要使用比这更具体的模板名称,例如该部分中显示的最后一个可能的模板名称 - 例如views-view-fields--myview--default.tpl.php
.
到达那里后,您将需要一个全局变量来跟踪当前行,例如:
<?php
global $is_first_of_term;
if(!isset($is_first_of_term)){
$is_first_of_term = TRUE;
} else {
$is_first_of_term = FALSE;
}
// Then use $is_first_of_term below (unmodified original script)
// to print whatever you want.
?>
<?php foreach ($fields as $id => $field): ?>
<?php if (!empty($field->separator)): ?>
<?php print $field->separator; ?>
<?php endif; ?>
<<?php print $field->inline_html;?> class="views-field-<?php print $field->class; ?>">
<?php if ($field->label): ?>
<label class="views-label-<?php print $field->class; ?>">
<?php print $field->label; ?>:
</label>
<?php endif; ?>
<?php
// $field->element_type is either SPAN or DIV depending upon whether or not
// the field is a 'block' element type or 'inline' element type.
?>
<<?php print $field->element_type; ?> class="field-content"><?php print $field->content; ?></<?php print $field->element_type; ?>>
</<?php print $field->inline_html;?>>
<?php endforeach; ?>