Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Pos and modulo

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: 1464 Views
  • g
    Avatar
    Community Member
    22 Posts

    Pos and modulo Link to this post

    I need to highlight every third record returned to a template. I'm using this syntax:

    <% control getMemberProjects %>

    <% if Pos%3==0 %>
    <b>$name</b>
    <% end_if %>

    <% end_control %>

    There is no way to perform modulo or anything more complex than equality with the if statement in the template. Any ideas how to handle this?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Pos and modulo Link to this post

    A solution would be to alter your dataobjectset in your class by using the customise function (http://api.silverstripe.com/sapphire/view/ViewableData.html#customise).

    It is a kind of dirty hack , but you could for example add a booleon to your dataobjectset which you use in the template to decide whether or not to hi-lite the row.

    Good luck !

    1464 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.