17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1548 Views |
-
If blocks

29 June 2007 at 5:48pm
'If blocks' documentation referred to: http://doc.silverstripe.com/doku.php?id=templates#if_blocks
It says in the documentation that currently negations such as x != 3 are not available. Does this mean that tests such as x == 3 are available?
Is it testing only on the presence of the particular property?
Can you test subproperty elements: eg. <% if $LinkingMode.current %> (stuff goes here) <% end_if %> ?Things are looking up!
-
Re: If blocks

30 June 2007 at 4:36am Last edited: 30 June 2007 4:37am
> Does this mean that tests such as x == 3 are available?
Yes, but for some reason, the comparison use a single = sign. Example here:
http://www.silverstripe.com/silverstripe-development/flat/1663?showPost=1673#post1673> Can you test subproperty elements: eg. <% if $LinkingMode.current %> (stuff goes here) <% end_if %> ?
You should be able test anything that can be accessed. I think syntax you want is <% if LinkingMode = current %>
Example:
<% control Menu(1) %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.</span></a>
<% if LinkingMode = current %>
This is the current page
<% end_if %>
</li>
<% end_control %>For similar examples see:
http://doc.silverstripe.com/doku.php?id=built-in-page-controls#page_controls_that_can_be_used_anywhere> Things are looking up!
Great! I hope things continue to go well for you.
Have a good weekend,
Elijah
| 1548 Views | ||
|
Page:
1
|
Go to Top |


