{view:vid[:ids[:settings]]}

Description

Renders a stored AA view and returns its HTML output. This is the main way to embed one slice listing inside another template, page, e-mail, or even inside another view.

The view supplies the layout and the default item set, sort and conditions (all configured in the View admin). At call time you may narrow the view to a specific set of items and override individual view settings.

vid accepts the numeric view ID or a named view alias. The ids parameter restricts output to the listed items (dash-separated long IDs, typically produced by ids). The settings parameter overrides stored view options as comma-separated name-value pairs, for example listlen-5 or sort-headline........

Note: when you pass ids, the view still applies its own sort - the items come back in the view sort order, not the order you listed them. Pass settings sort-AAnoSORT to keep the exact ids order. An empty or missing vid renders nothing.

This is the colon form handled by AA_Stringexpand_View. AA also accepts a legacy query-string form, view.php?vid=N, which additionally supports cmd-style per-view conditions; prefer the colon form in new templates.

Parameters

vid required

The view to render. Accepts the numeric view ID (e.g. 146) or a named view alias (e.g. doc_stable). The view holds the layout, default item set, sort and conditions. An empty or missing value renders nothing.

Allowed values Any positive integer (the numeric view ID). Example: 57, 45, 24.
ids required

Restricts the view to a specific set of items. A dash-separated list of item long IDs, typically produced by the ids command. When omitted, the view renders its own configured item set. Note: the view still applies its own sort to these items unless you also pass settings sort-AAnoSORT.

Allowed values Dash-separated hex item IDs (short 16-char or long 32-char). Often the result of {ids:...} expression. Empty string = omitted (view runs its own query).
settings optional

Overrides stored view settings at render time. A comma-separated list of name-value pairs joined by a dash, for example listlen-3 or sort-headline........ or from-2,to-5. Recognized keys include listlen, from, to, page, random, sort (use AAnoSORT to disable sorting), group_by, group_limit and slices. To put a literal comma inside a value, double it as two commas.

Allowed values Comma-separated key-value pairs. Keys: page, listlen, from, sort, group_by. Value separator is dash (-). Example: listlen-3,sort-headline........-,from-2. Empty = use view's stored settings.

Examples

test{view:146}
ExpectedEpsilon=0; Zeta=0; Iota=1; Delta=7; Alpha=14; Beta=42; Eta=99; Gamma=100; Theta=255; Kappa=1000
ActualEpsilon=0; Zeta=0; Iota=1; Delta=7; Alpha=14; Beta=42; Eta=99; Gamma=100; Theta=255; Kappa=1000
The simplest call: render view 146 with all its stored settings. View 146 lists the Stable test slice as headline=number, sorted by number ascending (ties broken alphabetically by headline, so Epsilon comes before Zeta), joined with a semicolon. This is what you embed in a site page or template to show a slice listing.
virtual{view:doc_stable}
Expected(same items as view 146)
ActualEpsilon=0; Zeta=0; Iota=1; Delta=7; Alpha=14; Beta=42; Eta=99; Gamma=100; Theta=255; Kappa=1000
A view can carry a text alias (field vid in the View admin, lowercase a-z and underscore). Here doc_stable names the same view as 146. Important: a named alias only resolves inside that view's own slice context or a Site page; from an unrelated template it may not be found, so prefer the numeric ID for portable templates. (Marked virtual: its result depends on the calling context.)
test{view:146:5726c2c6b035d7aab450d1794e9e90d7-aa89ddc95136b966e6ec1419a2963741-ce4ac95c48c3bbe590b80794e47c3e7b}
ExpectedZeta=0; Delta=7; Gamma=100
ActualZeta=0; Delta=7; Gamma=100
The second parameter is a dash-separated list of item IDs. Only those three items render. Note the output is still in the view sort order (number ascending: Zeta=0, Delta=7, Gamma=100), not the order the IDs were listed - the view applies its own sort. See the AAnoSORT example to keep your order.
test{view:146:{ids:9e1d2b9f88e3d6c3bf0eb967378610d6:d-abstract........-=-red}}
ExpectedGamma=100
ActualGamma=100
The usual real-world pattern: let the ids command query the slice and feed its result into the view. Here ids returns the single item whose Short text field equals red (Gamma), and the view renders just that item.
test{view:146::listlen-2,sort-headline........}
ExpectedAlpha=14; Beta=42
ActualAlpha=14; Beta=42
The third parameter overrides stored view settings as comma-separated name-value pairs. Here listlen-2 keeps only the first two items and sort-headline........ re-sorts alphabetically by headline, so the first two are Alpha and Beta.
test{view:146::from-9,to-10}
ExpectedTheta=255; Kappa=1000
ActualTheta=255; Kappa=1000
from and to select a range by position (counting from 1). Items 9 and 10 in the view sort (number ascending) are Theta=255 and Kappa=1000. Use listlen with page for normal pagination; from-to is for a fixed window.
test{view:146:5726c2c6b035d7aab450d1794e9e90d7-ce4ac95c48c3bbe590b80794e47c3e7b-aa89ddc95136b966e6ec1419a2963741:sort-AAnoSORT}
ExpectedGamma=100; Zeta=0; Delta=7
ActualGamma=100; Zeta=0; Delta=7
To preserve the exact order of the IDs you passed (instead of the view sort), add sort-AAnoSORT. The view drops its ORDER BY and lists items in the ids order: Gamma, Zeta, Delta.