17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 3335 Views |
-
if-statement for variables, strings etc.

7 October 2008 at 10:51pm
Hi Everyone
I have a smaller problem that I need some help with. And it should be really simple.
I want to create an if statement for variables in my classes/templates, just like I do with menus in the template, i.e.
<% if Menu(2) %>
<div id="mySecondMenu">
<% control Menu(2) %>
...
<% end_control %>
</div>
<% end_if %>So what I basically would do is this:
<% if $myImage %>
<img src="$myImage"/>
<% end_if %>Does it make sense?
I'll try to explain. Let's say for instance that I've created an image in a template (both in the class file and template), but the user doesn't fill it out in the backend. Now of course the image doesn't show up in front, because there is no, instead the browser is showing me a questionmark, and that looks pretty silly.
Can anyone help, thanks.
Joel
-
Re: if-statement for variables, strings etc.

7 October 2008 at 11:15pm
Ah,
Remove the dollar sign. Your template should look like:
<% if myImage %>
<img src="$myImage"/>
<% end_if %>Should work fine
-
Re: if-statement for variables, strings etc.

8 October 2008 at 12:15am
Ok, one more question though.
I've tried to make two checks with the && sign, and that works too.
Now, is there a way to write "or", something like this:
<% if MyFirstVariable or MySecondVaribale %> //Where either the first or second variable is true?
Thanks again...
| 3335 Views | ||
|
Page:
1
|
Go to Top |


