ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

cond

Summary

Returns the value of the first clause who's condition is TRUE.

Usage

cond( cond1, value1 [, cond2, value2 [, ... ] ] )

Parameters

NameTypeDescriptionRequired
cond1 boolean Match condition 1. Yes.
value1 any Return value for condition 1. Yes.
cond2 boolean Match condition 2. No.
value2 any Return value for condition 2. No.

Returns

One of the provided values or FALSE.

Description

This operator evaluates the provided conditions (odd numbered parameters). If one of the conditions evaluates to TRUE then the value which is associated with that condition is returned. If none of the conditions are TRUE, the operator will return FALSE. If an odd number of parameters are provided, the operator will return the last parameter if all conditions fail.

Examples

Example 1

{cond( true(), 'apples', true(), 'bananas' )}

The following output will be produced: "apples".

Example 2

{cond( false(), 'apples', true(), 'bananas' )}

The following output will be produced: "bananas".

Example 3

{cond( false(), 'apples', false(), 'bananas' )}

No output will be produced, the operator will return FALSE.

Example 4

{cond( false(), 'apples', 'bananas' )}

The following output will be produced: "bananas".

Balazs Halasy (05/02/2004 10:39 am)

Balazs Halasy (04/05/2005 2:05 pm)


Comments

There are no comments.