Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

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.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Template page control with boolean operators


Go to End


6 Posts   11799 Views

Avatar
cliersch

Community Member, 75 Posts

24 May 2008 at 4:11am

Edited: 24/05/2008 4:14am

Hi there,

is it possible to use boolean operators in the template page control?
I want to have a control structur witch combines arguments with an "OR" e.g.

<% if ClassName = HomePage %>
<p>Hello</p>
<% end_if %>

<% if ClassName = BlogHolder %>
<p>Hello</p>
<% end_if %>

Are boolean operators possible in some way?

Avatar
Sean

Forum Moderator, 922 Posts

24 May 2008 at 10:43am

That should be possible.

Avatar
Hamish

Community Member, 712 Posts

24 May 2008 at 12:06pm

What's the syntax?

None of the following work:

<% if ClassName = a || ClassName = b %>

<% if ClassName = a | ClassName = b %>

<% if ClassName = a or ClassName = b %>

Avatar
dio5

Community Member, 501 Posts

26 May 2008 at 8:20am

AFAIK using OR is not possible.

Using just boolean checks is though, but no OR's / AND's afaik. Would be handy though.

Avatar
cliersch

Community Member, 75 Posts

26 May 2008 at 7:05pm

Edited: 26/05/2008 7:08pm

-> no result! No "OR's / AND's" are working!
Oh - ok, thanks!
But thats a shame!!!
Maybe someone will fix it some day! :-)

Avatar
Willr

Forum Moderator, 5523 Posts

26 May 2008 at 10:49pm

there has been a few template discussions on the dev list - http://groups.google.com/group/silverstripe-dev/browse_thread/thread/db752c5de80f3156