-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,44 @@ | ||
In Array | ||
================= | ||
|
||
ExpressionEngine 2 Plugin | ||
In Array Usage | ||
==================== | ||
|
||
Searches for a value within given pipe or comma separated values | ||
---------------------------------------------------------------- | ||
|
||
To use this plugin, enter the value to search for in the value parameter | ||
and pipe or comma delimited values in the array parameter: | ||
|
||
`{exp:in_array value="3" array="2|4|5|20"}` | ||
{exp:in_array value="3" array="2|4|5|20"} | ||
|
||
`{exp:in_array value="Cow" array="The|Cow|Jumped|Over|The|Moon"}` | ||
{exp:in_array value="Cow" array="The|Cow|Jumped|Over|The|Moon"} | ||
|
||
**Typical use:** | ||
Typical use: | ||
|
||
`{if '{exp:in_array value="2" array="1|2|3"}'} | ||
{if '{exp:in_array value="2" array="1|2|3"}'} | ||
We found your value | ||
{/if}` | ||
{/if} | ||
|
||
`{if '{exp:in_array not="4|5" array="1|2|3"}'} | ||
{if '{exp:in_array not="4|5" array="1|2|3"}'} | ||
We did not find your value | ||
{/if}` | ||
{/if} | ||
|
||
**Tag Pair:** | ||
Tag Pair: | ||
|
||
`{exp:in_array:pair value="2" array="1|2|3"} | ||
{exp:in_array:pair value="2" array="1|2|3"} | ||
{if no_results}Value not found{/if} | ||
We found your value | ||
{/exp:in_array:pair}` | ||
{/exp:in_array:pair} | ||
|
||
Alternative no_results: Note that this only works with no "if" conditions inside it. | ||
|
||
`{exp:in_array:pair value="2" array="1|2|3"} | ||
{exp:in_array:pair value="2" array="1|2|3"} | ||
{if in_array:no_results}Value not found{/if} | ||
We found your value | ||
{/exp:in_array:pair}` | ||
{/exp:in_array:pair} | ||
|
||
|
||
**Available parameters:** | ||
Available parameters: | ||
|
||
value="X" : The value to find in the array | ||
not="X" : The value not to find in the array | ||
array="1|2|3|4" : the values in the array to search | ||
delimiter="|" : change the default pipe delimiter | ||
case_insensitive="y" : make the search case insensitive | ||
case_insensitive="y" : make the search case insensitive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return array( | ||
'author' => 'Simon Andersohn', | ||
'author_url' => '', | ||
'name' => 'In Array', | ||
'description' => 'Searches for a value within given pipe or comma separated values', | ||
'version' => '1.4', | ||
'namespace' => '\\', | ||
'docs_url' => '' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters