我有一些代码根据条目的行值创建一个交替行颜色的表。ExpressionEngine表中的交替行颜色
<table class="authorList" cellspacing="0">
{exp:channel:entries channel="team" disable="categories|member_data|pagination" orderby="team-last-name" sort="asc"}
{if team-not-with-us != 'y'}
<tr class="{switch="odd|even"} authorInfo">
<th class="authorName">
{if team-bio != ''}<a href="{site_url}about/the-team/{url_title}">{/if}
{title}
{if team-bio != ''}</a>{/if}
</th>
<td class="position">{team-position}</td>
</tr>
{/if}
{/exp:channel:entries}
</table>
问题是,当我删除的条目,我结束了连续有两个奇数或两个偶数,并排留下我有两个相同颜色的行侧。
虽然开关功能很方便,但它引用了数据库中的行数。我不相信我可以用它来引用if语句中的实际行数来解决我的问题。 (纠正我,如果我错了。)
我知道如何使用PHP这样的变化:
<?php $oddevenrow = 0; ?>
{if team-not-with-us != 'y'}
<?php $oddevenrow++; ?>
<?php ($oddeven = ($oddevenrow % 2 ? 'odd' : 'even')); ?>
<tr class="<?php echo $oddeven; ?> authorInfo">
但我不能在EE打开PHP安装。
在EE中我能做些类似的事吗?
谢谢!
谢谢。我发誓我昨天晚上在看用户指南(http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html)和“想法”我读了这一切,但完全错过了搜索参数。 – Yazmin 2013-03-20 17:12:25