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   11127 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, 5513 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