{rotator:ids:code:interval:speed:effect:li_code}

Description

Builds a rotator (a slideshow or carousel) that cycles through several content blocks in one spot on the page, switching automatically at a fixed interval. You give it a list of item ids and a small template; for each item it expands the template into one frame, stacks the frames in a div, shows the first, and emits a script that advances to the next frame on a timer. Inside the frame template, an alias such as _#HEADLINE resolves against the item being shown, not the surrounding page, so each frame can carry that item's own fields. The rotation is driven by AA_Rotator in the aa-jslib JavaScript library, which rotator requests automatically; hovering the rotator pauses it and moving away resumes it. The interval is given in milliseconds and defaults to 3000 (three seconds). speed sets how fast each switch animates (the jQuery duration: empty for an instant change, or slow or fast) and effect chooses how it switches (empty hides and shows the frame, fade cross-fades it). An optional sixth template, the li-code, builds a clickable list of switcher buttons under the frames so a visitor can jump to or hover over any frame. Items whose frame template expands to nothing are skipped, and an empty id list or a single frame produces no rotation. rotator reads live items and emits markup with a generated id, so its output is recomputed on every request rather than cached.

Parameters

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).
code required default (empty)

The frame template - an AA expression expanded once per item to build that frame. It is expanded against the item being shown, so aliases and field getters inside it read that item (for example code or {headline........} give each item its own headline). An item whose template expands to an empty string is skipped.

interval optional default 3000

How long each frame stays visible before the next one, in milliseconds. Empty or zero falls back to 3000 (three seconds).

speed optional default (empty)

How fast each switch animates - the jQuery animation duration. Empty means an instant change; slow and fast are the named jQuery speeds (600 ms and 200 ms). A number of milliseconds also works.

effect optional default (empty)

How frames switch. Empty hides the old frame and shows the new one with no transition; fade cross-fades between them (the frames are stacked absolutely so they overlap during the fade).

li_code optional default (empty)

Optional switcher template. When given, rotator also renders a list (ul.rot-switcher) of clickable buttons under the frames, one per frame, built by expanding this template per item just like code. Clicking or hovering a button jumps to that frame. Leave empty for no switcher.

Examples

virtual{rotator:{ids:9e1d2b9f88e3d6c3bf0eb967378610d6}:<div>_#HEADLINE</div>}
Expected(one frame per item in the Stable slice, each
Headline
, rotating every 3 seconds)
Actual
Zeta
The real-world shape: feed the ids with an inner reader instead of hard-coded ids, so the rotator follows a whole slice (here every item in the Stable test slice). Add conditions to ids to rotate only selected items.
virtual{rotator:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0:<div>_#HEADLINE</div>:5000:slow:fade}
Expected(two frames that cross-fade slowly every 5 seconds: AA_Rotator(id, 5000, 2, 'slow', 'fade'), frames positioned absolutely)
Actual
Alpha
Parameters four and five are speed and effect. effect fade cross-fades between frames; with fade the frames are stacked absolutely so they overlap during the transition. speed slow animates each switch over 600 ms. Empty speed plus empty effect (the default) would switch instantly with no fade.
virtual{rotator:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0:<div>_#HEADLINE</div>:8000}
Expected(the same two frames, now AA_Rotator(id, 8000, 2, '', '') - 8 seconds each)
Actual
Alpha
The third parameter is the interval in milliseconds. Here each frame shows for 8000 ms (eight seconds) before the next. Empty or 0 would fall back to the 3000 ms default.
virtual{rotator:a65d19971986e750761f0efcd9a16b1b:<div>_#HEADLINE</div>}
Expected(empty output - a rotator needs at least two frames to rotate)
Actual
Alpha
A single id (or an empty id list) yields one frame or none. rotator still emits the markup, but the AA_Rotator script returns early when there are fewer than two frames, so there is nothing to rotate. In practice always give it two or more items.
virtual{rotator:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0:<div>_#HEADLINE</div>}
Expected(a div id="rot..." holding
Alpha
and
Beta
, plus a script AA_Rotator(id, 3000, 2, '', '') that flips them every 3 seconds)
Alpha
and
Beta
, plus a script AA_Rotator(id, 3000, 2, '', '') that flips them every 3 seconds)">Actual
Alpha
The simplest rotator: two items, one frame template. The template <div>_#HEADLINE</div> is expanded per item, so frame one is <div>Alpha</div> and frame two is <div>Beta</div>. interval is omitted, so it defaults to 3000 ms. The exact id is a hash, which is why this is shown as illustrative, not asserted.
virtual{rotator:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0:<div>_#HEADLINE</div>:6000:fast:fade:<span>_#HEADLINE</span>}
Expected(the frames, plus a ul.rot-switcher of two buttons labelled Alpha and Beta; clicking or hovering a button shows that frame)
Actual
Alpha
  • Alpha
  • Beta
The full six-parameter form, matching real production use. The sixth parameter, li-code, is a second per-item template that builds a switcher: a ul.rot-switcher with one li per frame (here labelled by _#HEADLINE). Visitors can click or hover a button to jump to that frame; the first button starts active.