We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Value Aggregator

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.

This plugin allows you to compose from several values a string suitable for use as a value of parameter.

PARAMETERS:

operator1 - Optional. Allows you to specify operator which will be appended once on the left in resulting string. E.g if the value of “operator1” parameter is “not”, then resulting string will be “not the_rest_of_string”.

operator2 - Optional. Allows you to specify operator which will be included between every value pair. E.g. if the value of “operator2” parameter is “&”, then resulting string will be “first_value&second;_value&third;_value”. Default value of this parameter is “|”.

value1, value2, value3 … value50 - Optional. Allows you to specify up to 50 values.

append_left - Optional. Allows you to specify string which will be appended on the left in resulting string. E.g if the value of “append_left” parameter is “|”, then resulting string will be “|the_rest_of_string”.

append_right - Optional. Allows you to specify string which will be appended on the right in resulting string. E.g if the value of “append_right” parameter is “|”, then resulting string will be “the_rest_of_string|”.

VARIABLES:

{value_aggregator_result} - outputs string composed from several values and suitable for use as a value of parameter.

{nonempty_values_number} - outputs number of non-empty values passed as parameters to the {exp:value_aggregator} tag.

Conditionals are supported.

EXAMPLE OF USAGE:

The code

{exp:value_aggregator append_left="|" value1="200" value2="198" value3="201" value4="88" value5="93" value6="197" value7="" value8="" value9="" value10=""}

{value_aggregator_result}

{/exp:value_aggregator}

will output the string “|200|198|201|88|93|197”

More complicated example:

{exp:weblog:entries weblog="weblog_common" category="6" sort="asc" limit="1" dynamic="off"}

{exp:value_aggregator operator1="not" value1="{custom_field1}" value2="{custom_field2}" value3="{custom_field3}" value4="{custom_field4}" value5="{custom_field5}" value6="{custom_field6}" value7="{custom_field7}" value8="{custom_field8}" value9="{custom_field9}" value10="{custom_field10}"}

{exp:entries_list category="6" weblog="{value_aggregator_result}" sort="asc" site="1"}
{entries_list_title}

{/exp:value_aggregator}

{/exp:weblog:entries}
       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

Hi,

I released version 1.1 of Value Aggregator plugin.

In this release:

1) added support for conditionals;

2) added a new variable - {nonempty_values_number}; this variable outputs number of non-empty values passed as parameters to the {exp:value_aggregator} tag.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.