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.

Archive

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

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

Template page control with boolean operators


Reply

6 Posts   11059 Views

Avatar
cliersch

24 May 2008 at 4:11am (Last edited: 24 May 2008 4:14am), Community Member, 75 Posts

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

24 May 2008 at 10:43am Forum Moderator, 921 Posts

That should be possible.

Avatar
Hamish

24 May 2008 at 12:06pm Community Member, 712 Posts

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

26 May 2008 at 8:20am Community Member, 501 Posts

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

26 May 2008 at 7:05pm (Last edited: 26 May 2008 7:08pm), Community Member, 75 Posts

-> 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

26 May 2008 at 10:49pm Forum Moderator, 5511 Posts

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