17691 Posts in 4607 Topics by 2180 members
General Questions
SilverStripe Forums » General Questions » if clouse: sintax error
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 716 Views |
-
if clouse: sintax error

16 December 2009 at 4:27am Last edited: 16 December 2009 5:52am
Hi!
In my .ss page I wrote this line of code. My proble is apply an if clouse to every div.
For example :
if $Name != '' then show div else go on.
Can you hel me write this in a correct way please?My <% if $Nome !='' %> is not correct
<% if Conn %>
<ul id="product">
<% control Conn %>
<li>
<% if $Nome !='' %><div class="nome_query_2"> $Nome </div><% end_if %>
<% if $Type !='' %><div class="nome_query_2"> $Type </div> <% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>And if I need an or clouse?for example <% if $Nome !='' or $Type !='' %> what is the correct syntax?
Thanks! -
Re: if clouse: sintax error

16 December 2009 at 9:05am
You cannot use != '' in the template parser. In your case you are just checking that Name exists, which you should just be able to do <% if Name %>
| 716 Views | ||
|
Page:
1
|
Go to Top |


