Jump to:

3392 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » Problem with <%if > control

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

Page: 1 2 3
Go to End
Author Topic: 7955 Views
  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Problem with <%if > control Link to this post

    Ask and you shall receive - http://doc.silverstripe.org/templates#modulus_and_multipleof.

    We're trying to be proactive with the docs. A huge effort is taking place to rebuilt and rewrite, tidy up so if you see something missing that should be documented (like this) throw up a ticket to open.silverstripe.org. We will be dealing with those in the coming months.

    I personally at least get carried away with new features and code and because I know it, everyone else must know it but I'm attempting to change such bad habits

  • kcd
    Avatar
    Community Member
    54 Posts

    Re: Problem with <%if > control Link to this post

    Modulus and multipleof are great. I'm trying to use them to detect the first and last items in a row of four columns, but...

    This works:

    <% if MultipleOf(4) %> I'm a multiple of 4 <% end_if %>

    This doesn't:

    <% if MultipleOf(4, 3) %> Anything as a second parameter breaks <% end_if %>

    I cannot see why I cannot pass the second parameter, anyone?

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Problem with <%if > control Link to this post

    Agree to kcd's issue. Same Problem. Inside a loop

    the following works:
    (every 3rd Element starting by 1 => 1,4,7,10....)

    {$MultipleOf(3,3)}

    the following does not:
    (results in Parse error: syntax error, unexpected '}' in....)

    <% if MultipleOf(3,3) %>

    Any ideas would be great ...

    7955 Views
Page: 1 2 3
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.