The Gallery3xPlaceholders plugin (OnLoadWebDocument event) puts the images of the current resource into placeholders: [[+g3x.0]] — the first image rendered with a chunk, [[+g3x.0.medium]] — its thumbnail URL, and so on. No snippet call is needed.
Off by default: every page runs an extra query. Enable it only if you really use the placeholders, and limit the templates with
gallery3x.placeholders_for_templates.
Settings
| Key | Default | Description |
|---|---|---|
gallery3x.set_placeholders | No | Enable. |
gallery3x.placeholders_for_templates | empty | Template IDs, comma-separated; empty — all. |
gallery3x.placeholders_thumbs | small,medium,big | Which thumbnail sizes to expose. |
gallery3x.placeholders_tpl | @INLINE <a href="[[+url]]"><img src="[[+medium]]" alt="[[+alt]]"></a> | Chunk for [[+g3x.N]] (@INLINE is allowed, Fenom — if pdoTools is installed). Empty — a data array is output (for debugging). |
Placeholders
The number N starts from zero, in gallery order; enabled images only.
| Placeholder | Value |
|---|---|
[[+g3x.N]] | The image rendered with the gallery3x.placeholders_tpl chunk |
[[+g3x.N.url]] | Original URL |
[[+g3x.N.small]], [[+g3x.N.medium]] … | Thumbnail URLs from gallery3x.placeholders_thumbs (without _url) |
[[+g3x.N.name]], .alt, .description | Image texts |
[[+g3x.N.id]], .group, .special, .extra_text … | Other record fields |
Inside the gallery3x.placeholders_tpl chunk the same fields have no prefix: [[+url]], [[+medium]], [[+alt]].
Examples
<img src="[[+g3x.0.medium]]" alt="[[+g3x.0.alt]]">
[[+g3x.0]] [[+g3x.1]] [[+g3x.2]]
In a Fenom template:
{if $_modx->getPlaceholder('g3x.0.url')}
<div class="product-gallery">
<img src="{$_modx->getPlaceholder('g3x.0.medium')}" alt="{$_modx->getPlaceholder('g3x.0.alt')}">
{for $i = 1 to 10}
{set $small = $_modx->getPlaceholder('g3x.' ~ $i ~ '.small')}
{if $small}<img src="{$small}" alt="">{/if}
{/for}
</div>
{/if}