Documentation · ViewHelper reference

XSD schema file | vhs master

Iterator / IndexOfViewHelper

Searches $haystack for index of $needle, returns -1 if $needle is not in $haystack. /

  • Tag usage example

    <v:iterator.indexOf then="[mixed]" else="[mixed]" condition="1" needle="[mixed]" haystack="[mixed]" considerKeys="1">
    	<!-- tag content - may be ignored! -->
    </v:iterator.indexOf>
  • Inline usage example

    {v:iterator.indexOf(then: [mixed], else: [mixed], condition: 1, needle: [mixed], haystack: [mixed], considerKeys: 1)}

Arguments

Argument Description Type
condition

Condition expression conforming to Fluid boolean rules

boolean
considerKeys

Tell whether to consider keys in the search assuming haystack is an array.

boolean
else

Value to be returned if the condition if not met.

mixed
haystack

Haystack in which to look for needle

mixed
needle

Needle to search for in haystack

mixed
then

Value to be returned if the condition if met.

mixed
Required attribute

Revision history

commit 542b285a13c3bae5b726f7ce50f8324457631c51
Author: Claus Due <*****@wildside.dk>
Date:   Sat Nov 3 16:27:35 2012 +0100

    [FEATURE] Iterator ViewHelpers
    
    Explode, Implode, First, Last, IndexOf, Next, Previous, Loop and Sort
    ViewHelpers.

commit f9faca970f0d537242651764bdf44734abafa187
Author: Björn Fromme <*****@bjo3rn.com>
Date:   Mon Dec 16 17:51:09 2013 +0100

    [TASK] Refactor class inheritance

commit da31bad1d9bb058c072ddb5591e8ed907a1ae8e1
Author: Claus Due <*****@namelesscoder.net>
Date:   Tue Dec 31 23:08:37 2013 +0100

    [TASK] Happy new year!

commit 52bd6e41ccfef3d8193b350153912a9716e6a087
Author: Benjamin Rau <*****@codearts.at>
Date:   Tue Apr 1 21:09:00 2014 +0200

    [TASK] CGL compliance

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file