Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

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

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

if structures more explained


Reply


2 Posts   1212 Views

Avatar
CriaturaCreativaStudio

Community Member, 73 Posts

12 December 2008 at 11:41am

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,

Eduardo

Avatar
Willr

Forum Moderator, 5513 Posts

12 December 2008 at 4:41pm

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 %>