Forums / Setup & design / How does "and" works? cond(and($current_node....

How does "and" works? cond(and($current_node....

Author Message

Guilherme Longo

Tuesday 04 September 2007 6:17:16 am

Finishing my question for today, i've aready tryed find in ez Forum and web but i didnt find how that operator works:

$current_node_in_path = cond(<b>and<b>($current_node_id, ........

I would like to know how does <b>and<b> works

André R.

Tuesday 04 September 2007 8:54:56 am

http://ez.no/doc/ez_publish/technical_manual/3_9/reference/template_operators/logical_operations

Example:

{if and( is_set( $node ), $node.node_id|eq( 2 )  )}
  You are on the root node<br />
{/if}

in php code that would be something like:

if ( isset( $node ) && $node->attribute('node_id') == 2  )
{
  echo 'You are on the root node<br />';
}

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Olivier Ouin

Tuesday 04 September 2007 9:36:31 am

Like most of eZ templates operator, you have two way to use it.

Let say we have 2 booleans $cond1 and $cond2.

You can test that these 2 booleans are not false with :

    {if and($cond1, $cond2)} ok {/if}

or

    {if $cond1|and($cond2)} ok {/if}

It's up to you.

Guilherme Longo

Wednesday 05 September 2007 2:19:37 am

hum, ok!

basicly, if i want test more than 1 condition in "once time" I need to use "and" logical operator!!

That's fine.

Thank so much!