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 :)
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
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 :)
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 %>
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 :)
as I said the template parser is pretty basic :P 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
Hiaa willr,
sorry i m sending thanx late.
it allready done with the same link which u sent me b4.
thanx once again :)
ciao.