Gallery3xMixed

Gallery3x1 min readPage 7 of 22
On this page 3

The [[!Gallery3xMixed]] snippet outputs the images and videos of one resource together — as one list or by group. The default chunk is written in Fenom, so pdoTools is required.

Parameters

ParameterDefaultDescription
&resourcecurrent resourceResource ID.
&groupBygroupGrouping field (group — by groups; an image with several groups goes into each). Empty — no grouping. Items without a group go to “Без группы” (“No group”).
&mixOrder11 — images and videos in one order by &sortby; 0 — all images first, then all videos.
&sortbypositionSort field: position, createdon, id.
&sortdirASCASC or DESC.
&limit0How many items, 0 — all.
&offset0How many to skip from the start.
&showInactive01 — include disabled.
&thumbSizesmallWhich image thumbnail size goes into the thumb field.
&source—Media source for the URLs (ID or name).
&tpltpl.Gallery3x.Mixed.FenomOutput chunk.

What the chunk receives

  • {$grouped} — an array “group name → items” (with &groupBy), otherwise null.
  • {$media} — a flat list of items (without grouping).
Item fieldValue
media_typeimage or video
unique_idimg_5 / video_3
titleTitle (for images — the “Title” field)
thumbThumbnail: for images — the &thumbSize size, for videos — the cover
urlImages — the original URL, videos — the video link
group, position, active, specialCommon fields
images onlyname, alt, description, file, path, original_url, small_url, medium_url, big_url…
videos onlyservice, video_id, description, thumbnail_url

Examples

[[!Gallery3xMixed]]

[[!Gallery3xMixed? &groupBy=`` &limit=`12`]]

[[!Gallery3xMixed? &mixOrder=`0` &thumbSize=`medium`]]

Your own chunk:

{* chunk tpl.mysite.mixed *}
{if $grouped is array}
    {foreach $grouped as $groupName => $items}
        <h2>{$groupName}</h2>
        <div class="grid">
            {foreach $items as $item}
                {if $item.media_type == 'image'}
                    <a href="{$item.url}"><img src="{$item.thumb}" alt="{$item.title}"></a>
                {else}
                    <a href="{$item.url}" target="_blank">▶ {$item.title}</a>
                {/if}
            {/foreach}
        </div>
    {/foreach}
{/if}

[[!Gallery3xMixed? &tpl=`tpl.mysite.mixed`]]