This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » If statement with or?

If statement with or?

If statement with or?

Thursday 18 March 2010 4:34:40 pm - 4 replies

I'm attempting to write a conditional statement in template code that accomplishes the following (pseudocode):

if (class.textline == 'string' OR class.textline == 'different string') { dostuff }

Code similar to the above doesn't seem to work, and I can find no documentation on OR logic in eZ Publish conditionals. Little help?

Thursday 18 March 2010 4:43:12 pm

HI Ben,

This would be something like this :

{if or( eq( $myString, 'string' ), eq( $myString, 'different string' ) )}
  {* do stuff here *}

More on the operator there :

Cheers !

Thursday 18 March 2010 4:48:05 pm

Ah, I see.

What if I want to match only a part of the variable? For example:

if ($myvar.contains('string')) { doStuff; }

Thursday 18 March 2010 5:09:57 pm

Hei Ben,

What you are looking for is this :

Happy string parsing,

Thursday 18 March 2010 5:12:36 pm

Exactly what I was looking for, thanks much!!


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from