Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » <% if Odd %> doesn't work

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 868 Views
  • gakenny
    Avatar
    Community Member
    153 Posts

    <% if Odd %> doesn't work Link to this post

    Hello,

    I have been trying to use <% if Odd %> to alternate background colours of a list. This works for the first and second entries. However, the third and greater entries have the same background colour as the second entry.
    <% if Odd %>
    <tr class="bg_colour1">
    <% else %>
    <tr class="bg_colour2">
    <% end_if %>

    However, <% if Even %> works fine and provides an alternative method to achieve the same result.
    <% if Even %>
    <tr class="bg_colour2">
    <% else %>
    <tr class="bg_colour1">
    <% end_if %>

    Anyone experienced the same issue?

    Cheers,

    Gary

    868 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.