{item:ids:content:delimiter:top:bottom:bin}

Description

Fetches one or more items by ID and renders a template against each of them. It is the core cross-slice lookup: read a field from a known item, or expand a small per-item template, without building a full view. Often paired with the ids command, which returns a dash-separated list of item IDs to feed in.

The content template is expanded in the context of each matched item, so reference the target item fields with that item aliases (such as _#HEADLINE). A plain field-getter inside content reads the surrounding item, not the fetched one.

When several IDs are given, the delimiter is placed between the per-item results. The delimiter also accepts two format modes: json returns a JSON object keyed by item ID, and jsonasoc reads each result as key to value and returns a JSON object. Empty per-item results are dropped before joining.

Only ACTIVE items are searched by default; the bin parameter widens this to HOLDING or TRASH. Tree notation with parentheses (with the top and bottom wrappers) renders nested structures such as breadcrumbs. An empty ID list returns an empty string. Parameters are not trimmed, so spaces in the delimiter are kept. Source: AA_Stringexpand_Item in stringexpand.php.

Parameters

ids required

One or more item IDs in short (16-char) or long (32-char) hex form, joined by dashes. Tree notation with parentheses is also accepted for hierarchical output, for example 3234(3443-3678)-4045. An empty value yields an empty result.

content optional

The template expanded against each matched item. Reference the target item's fields with its aliases, for example _#HEADLINE - a plain field-getter would read the surrounding item, not the target. Empty content yields empty output per item.

delimiter optional

Placed between the per-item results when several IDs are given. Two special values change the output format instead: json returns a JSON object keyed by item ID, jsonasoc reads each result as key->value and returns a JSON object.

top optional

Used only with tree notation. Printed before the children of each nested level (the opening wrapper of a subtree). Ignored for a plain dash-separated ID list.

bottom optional

Used only with tree notation. Printed after the children of each nested level (the closing wrapper of a subtree). Ignored for a plain dash-separated ID list.

bin optional default ACTIVE

Which item bins to search, dash-separated: ACTIVE, HOLDING, TRASH. Default is ACTIVE only, so holding or trashed items are invisible unless named here. Pending and expired items are not reachable.

Examples

test{item:5726c2c6b035d7aab450d1794e9e90d7:_#HEADLINE}
ExpectedGamma
ActualGamma
Reads one field from a single item by its ID. The content _#HEADLINE is an alias of the target item, replaced by that item's headline.
test{item:5726c2c6b035d7aab450d1794e9e90d7:_#NUMBER__}
Expected100
Actual100
Reads the numeric field of one item via its alias _#NUMBER__. Output is the stored value 100.
test{item:4f3362a62847fe1f8c59ba28a92d42c0-5726c2c6b035d7aab450d1794e9e90d7-ae1da231f3e5bc16496834a0711aa042:_#HEADLINE:, }
ExpectedBeta, Gamma, Kappa
ActualBeta, Gamma, Kappa
Several IDs joined by dashes are read in turn; the third parameter is the delimiter placed between each item's output.
test{item:5726c2c6b035d7aab450d1794e9e90d7:_#HEADLINE = _#NUMBER__}
ExpectedGamma = 100
ActualGamma = 100
The content parameter is a full template expanded against the target item, so it can mix literal text with several aliases.
test{item:4f3362a62847fe1f8c59ba28a92d42c0-5726c2c6b035d7aab450d1794e9e90d7-ae1da231f3e5bc16496834a0711aa042:_#HEADLINE:json}
Expected{"4f3362a62847fe1f8c59ba28a92d42c0":"Beta","5726c2c6b035d7aab450d1794e9e90d7":"Gamma","ae1da231f3e5bc16496834a0711aa042":"Kappa"}
Actual{"4f3362a62847fe1f8c59ba28a92d42c0":"Beta","5726c2c6b035d7aab450d1794e9e90d7":"Gamma","ae1da231f3e5bc16496834a0711aa042":"Kappa"}
The delimiter json returns a JSON object keyed by each item's full ID (not a plain array). Empty results are dropped before encoding. Use jsonasoc for your own keys.
test{item:5726c2c6b035d7aab450d1794e9e90d7-4f3362a62847fe1f8c59ba28a92d42c0:_#HEADLINE->_#NUMBER__:jsonasoc}
Expected{"Gamma":"100","Beta":"42"}
Actual{"Gamma":"100","Beta":"42"}
The delimiter jsonasoc reads each item as key->value (split on ->) and returns a JSON object keyed by the first part.
test{item:5726c2c6b035d7aab450d1794e9e90d7(4f3362a62847fe1f8c59ba28a92d42c0-ae1da231f3e5bc16496834a0711aa042):_#HEADLINE:, :[:]}
Expected[Beta, Kappa]
Actual[Beta, Kappa]
Tree notation nests children inside parentheses. top and bottom wrap each nested level; the delimiter separates siblings.
test{item:5726c2c6b035d7aab450d1794e9e90d7:_#HEADLINE::::ACTIVE-HOLDING}
ExpectedGamma
ActualGamma
The sixth parameter is the bin list. By default only ACTIVE items are read; naming HOLDING or TRASH widens the search. Here the active item is returned regardless.