17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1353 Views |
-
Expression for .ss file

26 September 2008 at 9:01pm
Hi All ,
I need to write relational expression in .ss file.
I m trying this way but its giving me error.
<% $MenuTitle == 'xyz' %>
Hello
<% end_if %>If anybody did this before please guide me.
Will be waiting for your reply .
Tareq
-
Re: Expression for .ss file

26 September 2008 at 9:42pm
The template parser is pretty basic - you can see what you can do here -> http://doc.silverstripe.com/doku.php?id=built-in-page-controls .. It should be able to support = to at least.
Try
<% if MenuTitle = xyz %>
Hello
<% end_if %> -
Re: Expression for .ss file

29 September 2008 at 7:21pm Last edited: 30 September 2008 6:41pm
Hi Willr,
Thanx a lot .
ohh,I checked this link now, while using logical operator "||" in expression it doesn't work.
<% control Menu(1) %>
<% if MenuTitle = Contactus || MenuTitle = Privacy %>
<% else %>
<li><a href="$Link" class="$LinkingMode">$MenuTitle</a></li>
<% end_if %>
<% end_control %>Its not allowing me to write above expression with "OR" operator.
Parse error: syntax error, unexpected '}' in D:\project\silver\silverstripe-cache\.cacheD..project.silver.themes.project_xyz.templates.Page.ss on line 94
Please guide me that where i m doing wrong or is their any updation in CMS.
ciao.
Regards,
Tareq
-
Re: Expression for .ss file

30 September 2008 at 9:11pm
as I said the template parser is pretty basic
you might have to do
<% control Menu(1) %>
<% if MenuTitle = Contactus %>
<% else %>
<% if MenuTitle = Privacy %>
<% else %>
<li><a href="$Link" class="$LinkingMode">$MenuTitle</a></li>
<% end_if %>
<% end_control %>Which I think does the same just have to nestle the ifs
-
Re: Expression for .ss file

22 October 2008 at 8:19pm
Hiaa willr,
sorry i m sending thanx late.
it allready done with the same link which u sent me b4.thanx once again
ciao.
| 1353 Views | ||
|
Page:
1
|
Go to Top |



