Share » Forums » Developer » "contains" isn't working

"contains" isn't working

"contains" isn't working

Friday 03 June 2011 2:54:24 am - 4 replies

Modified on Friday 03 June 2011 2:56:18 am by tom riddle

Author Message

SEBBANE Alexandre

Friday 03 June 2011 3:19:37 am

Hello

can you try without details in your array

i think contains work only with one dimension array...

let us know about this test.

 

Alex

Paris, France

tom riddle

Friday 03 June 2011 3:47:47 am

Hello

can you try without details in your array

i think contains work only with one dimension array...

let us know about this test.

 

Alex

I tried without details now:

PredefinedPageNodeIds[]=765
PredefinedPageNodeIds[]=1288

But it's still not working...

Tom

Marko Žmak

Friday 03 June 2011 3:59:17 am

First check if you have exact values in your variables. Try this:

{$currentNodeId}
{$PredefinedPageNodeIds|attribute(show)}

and see what do you get.

Also, the if condition shouldn't be in round brackets, so it should be like this:

{if $PredefinedPageNodeIds|contains($currentNodeId)}
  doSomehting...
{/if}

 

 

$PredefinedPageNodeIds

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

tom riddle

Friday 03 June 2011 4:17:27 am

First check if you have exact values in your variables. Try this:

{$currentNodeId}
{$PredefinedPageNodeIds|attribute(show)}

and see what do you get.

Also, the if condition shouldn't be in round brackets, so it should be like this:

{if $PredefinedPageNodeIds|contains($currentNodeId)}
  doSomehting...
{/if}

 

Ok, I've checked now:

 {$currentNodeId}

767

 {$PredefinedPageNodeIds|attribute(show)}
Attribute Type Value
0 string '765'
1 string '1288'

 

Then I removed the round brackets:

{else if $PredefinedPageNodeIds|contains($currentNodeId)}

But it's still TRUE...

 

------------------

SOLUTION:

It should be

{elseif $PredefinedPageNodeIds|contains($currentNodeId)}

and NOT

{else if $PredefinedPageNodeIds|contains($currentNodeId)}

There was a space between if and else...

 

Many thanks, Tom!

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

36 542 Users on board!

Forums menu