Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » if structures more explained

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: 1128 Views
  • CriaturaCreativaStudio
    Community Member
    73 Posts

    if structures more explained Link to this post

    Hello there,

    I'm a web designer, graphic designer that uses silvestripe from a few months ago...
    I'm pretty happy with the product, but i have a couple of doubts about structures (control structures), using %if, %elseif, etc.

    I've posted several problems here, and find people of the community being very kind, but i want to say that the documentation and reference guide it's a little messy, sometimes i found contents randomly...

    In fact i'm trying to use %if properly, and i didn't find any documentation that explains it more in detail (maybe it was my fault). Overall i would improve the way the documentation is displayed on this useful site.

    Anyone help regarding %if and multiple if instances would be great, (i'm looking for something ismilar to "swith - case" on php...

    Thanks In advance,


  • Willr
    Forum Moderator
    5497 Posts

    Re: if structures more explained Link to this post

    The documentation is in the process of being rewritten. Its been mentioned alot but it is happening.. just taking a looong time. As for switch case statements the template parser doesn't handle those. Basicly <% if %>, <% else %> and <% else_if %> is what you have to work with so you can do

    <% if X = A %>
    X = A!
    <% else_if X = B %>
    X = B!
    <% else_if X = C %>
    X = C!
    <% else %>
    Don't Know!
    <% end_if %>

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.