使用twig,如何在表行中添加交替颜色?
{% if pagination.getTotalItemCount > 0 %}
<div class="top17 panel panel-default">
<table class="table table-responsive table-striped">
{% for item in pagination %}
<tr class="tr-hover redirect" data-url="{{ url('item_details', {'id' : item.id}) }}">
<td class="hidden-xs item-image"><img src="{{ asset(item.webPath) }}"/></td>
<td>{{ item.name }}</td>
<td class="hidden-xs">{{ item.topic }}</td>
<td>{{ item.price }} SM</td>
<td>
<a href="{{ url('buy_item', { 'id' : item.id }) }}" class="btn btn-success">
<span class="glyphicon glyphicon-shopping-cart"></span>
<span class="hidden-xs">{{ "Buy" | trans }}</span>
</a>
</td>
</tr>
{% endfor %}
</table>
</div>