DEar all, I'm very new to silverstripe...
I would like to find out what's the way to write the condition like this?
if ($Title=="My Home"){...}
Hope you can share...
Thanks!
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.
DEar all, I'm very new to silverstripe...
I would like to find out what's the way to write the condition like this?
if ($Title=="My Home"){...}
Hope you can share...
Thanks!
Hi
welcome to SS the greatest CMS ever developed by humankind.
here is how you do it.
<% if Title == "My Home" %>
yo stuff here
<% else %>
second option
<% end_if %>
hope it will help
P
To check for equality, use = instead of ==. AFAIK spaces won't work either, so you better check the URLSegment or similar.
Something like this:
<% if URLSegment = my-url-segment %>
<% end_if %>
If you really want to check the title, create a custom function for it on your controller
just want to +1 that URLSegment is the way to go with these.
Hi all!
How to check this condition:
if ($Photo.Width > 100){...}
Thanks!