GalleryAlbums
Last updated Mar 6th, 2021 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$311 per month—let's make that $500!
Learn moreGalleryAlbums Snippet¶
This snippet displays a list of Albums. It by default only grabs "prominent" albums.
You can display a thumbnail for each album of an image in the album by setting the "rowTpl" property to "galAlbumRowWithCoverTpl", or using [[+image]]
in your custom rowTpl.
Properties¶
Name | Description | Default Value |
---|---|---|
rowTpl | The Chunk to use for each album row. | galAlbumRowTpl |
containerTpl | The Chunk to use for wrapping all album rows (available with 1.6.0 beta). | |
sort | The field to sort the results by. | createdon |
dir | The direction to sort the results by. | DESC |
limit | If set to non-zero, will limit the number of results returned. | 10 |
start | The index to start from in the results. | 0 |
toPlaceholder | If not empty, will set the output to a placeholder with this value. | |
showInactive | If 1, will show inactive galleries as well. | 0 |
showAll | If 1, will show all albums regardless of their parent. | 1 |
showName | If 0, will hide name of Album. | 1 |
parent | Grab only the albums with a parent album with this ID. Remember to set showAll to 0, otherwise it won't work! | 0 |
prominentOnly | If 1, will only display albums marked with a "prominent" status. | 1 |
albumCoverSort | The field which to use when sorting to get the Album Cover. To get the first image, use "rank". To get a random image, use "random". | rank |
albumCoverSortDir | The direction to use when sorting to get the Album Cover. Accepts "ASC" or "DESC". | ASC |
thumbWidth | The width for the cover album thumbnail. | 100 |
thumbHeight | The width for the cover album thumbnail. | 100 |
thumbZoomCrop | Whether or not to use zoom crop on the cover album thumbnail. | 1 |
thumbFar | The aspect ratio for phpThumb with the cover album thumbnail. | C |
thumbQuality | If quality of the cover album thumbnail, from 0-100. | 90 |
thumbProperties | A JSON object of parameters to pass to phpThumb as properties for the album thumbnail. | |
albumRequestVar | If checkForRequestAlbumVar is set to true on the Gallery snippet, will look for a REQUEST var with this name to select the album. | |
totalVar | Define the key of a placeholder set by GalleryAlbums indicating the total number of Albums that would be selected not considering the limit value (available with 1.6.0 beta). | total |
GalleryAlbums Chunks¶
The following chunks are processed in GalleryAlbums. The corresponding GalleryAlbums parameter are:
- rowTpl - The Chunk to use for each album displayed.
- containerTpl - The Chunk to use for wrapping all album rows (available with 1.6.0 beta).
Examples¶
Grab a list first 10 active, prominent albums.
[[!GalleryAlbums]]
Grab 10 alphanumerically sorted prominent albums:
[[!GalleryAlbums?
&sort=`name`
&dir=`ASC`
]]
Grab most recent 3 Albums, whether prominent or not, and set to the placeholder 'albums':
[[!GalleryAlbums?
&limit=`3`
&prominentOnly=`0`
&toPlaceholder=`albums`
]]
Display the most recent 3 albums with a random cover image.
[[!GalleryAlbums?
&limit=`3`
&albumCoverSort=`random`
]]
Using &thumbProperties to set the output of the album cover thumbnail to 90% quality jpg instead of png:
[[!GalleryAlbums?
&thumbProperties=`{"f":"jpg","q":"90%"}`
]]