3218 Posts in 854 Topics by 813 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1951 Views |
-
Whitespace in string comparison

21 January 2009 at 9:20am Last edited: 21 January 2009 9:28am
I'm a new user and I've been extending my SS install over the past few days. Everything has been smooth sailing until today when I tried evaluating a string in the template that contained whitespace. If I try..
<% if MenuTitle != "Contact Us" %>
or
<% if MenuTitle != 'Contact Us' %>
or
<% if MenuTitle != {Contact Us} %>
or
(anything, really)
I receive the same error about an unexpected } in Page.ss
I checked the SSViewer.php file and found the regexs that replace the template code and couldn't find any allowance of whitespace in them.
Is there something I'm missing? A special way to escape?
Any help is greatly appreciated, thanks.
-Chris
-
Re: Whitespace in string comparison

21 January 2009 at 9:56am
Not too sure that will work. I always compare URLSegments since they're whitespace free.
-
Re: Whitespace in string comparison

21 January 2009 at 9:58am
No you're not missing anything.
The template parser is kept very simple.
In your case you could use
<% if InSection(contact-us) %>
or
<% if URLSegment = contact-us %>
to overcome this issue.
| 1951 Views | ||
|
Page:
1
|
Go to Top |


