Hi all,
I am having a few issues with {switch}. I know why it’s doing what it’s doing (I think!), but I’m not sure how to get around it.
At the moment I am ordering my weblog by date, and using an {if} statement to only show entries where a custom field = “Team A”
Then displaying using the following code:
<table cellspacing="0" cellpadding="0">
<tr>
<th>Date</th>
<th>Home</th>
<th>Score</th>
<th>Away</th>
<th>Competition</th>
<th>Time</th>
<th>Venue</th>
<th>Report</th>
</tr>
{exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="asc" show_future_entries="yes"}
{if match_hometeam=="Team A" OR match_awayteam=="Team A"}
<tr class="{switch="|alt"}">
<td>{entry_date format="%j/%n/%Y"}</td>
<td><a href="http://site/matchreports/Team">Report</a></td>
</tr>
{/if}
{/exp:weblog:entries}
</table>So one <td> with a “alt” class, and the other without. Problem is, the colours don’t alternate. They appear random. I think this is because it is applying the switch to ALL the entries in the date-sorted order, then pulling the entries which match my conditional. If these happen to be the same ‘switch’, then the two rows will be the same colour.
Any thoughts?
cheers
Gizmo